Maxim Dsouza
Maxim Dsouza

Reputation: 1587

Jquery.find() returns null in ie, but not in other browsers

I am trying to code a jquery slider. I have a html code which looks like this. I had earlier posted a simpler version of code so that the question doesnt seem too long. Sorry for the inconvenience caused. Here is the actual code

<div class="allItems">  
    <div class="echItm">
        <h4>asdddddddd </h4>
        <span class="mImg">/web/images/promotionSlideShowImages/kc1g358wvv.jpg</span>
         <span class="tImg">/web/images/promotionSlideShowThumbnailsNew/kc1g358wvv.gif</span>
    </div>

     <div class="echItm">
        <h4>dddddddddd </h4>
        <span class="mImg">/web/images/promotionSlideShowImages/ptvrbfpnkd.jpg</span>
         <span class="tImg">/web/images/promotionSlideShowThumbnailsNew/ptvrbfpnkd.gif</span>
    </div>
 </div> 

When I try to do a find using

    var imagesArray=$('.allItems').find('.echItm');
    for(var i=0;i<imagesArray.length;i++){
    var thisElement=imagesArray[i];
    alert($(thisElement).html());
}

IE returns null, whereas firefox, chrome return the required html. Can someone guide me what am I doing wrong? I'm using Jquery 1.4.2 and testing this on IE8. Thanks in advance.

Upvotes: 0

Views: 5201

Answers (1)

ShankarSangoli
ShankarSangoli

Reputation: 69915

testElement is already a jQuery object so you don't have to wrap it in $(). Try this

var testElement=$('.echItm').find('h4');
alert(testElement.html());

Upvotes: 4

Related Questions