1

I have a div with id="gallery", and three images within:

<div id="gallery">
            <a class="trigger" href="images/fulls/01.jpg">
            <img class="thumb" src="images/thumbs/01.jpg">
            </a>
            <a class="trigger" href="images/fulls/02.jpg">
            <img class="thumb" src="images/thumbs/02.jpg">
            </a>
            <a class="trigger" href="images/fulls/03.jpg">
            <img class="thumb" src="images/thumbs/03.jpg">
            </a>
</div>

So when I do $('#gallery img').length; the value that I get is 3 in chrome, as expected. But, in firefox this value is 51.

Opera, safari, and internet explorer give 3 also.

Here's the fiddle link: http://jsfiddle.net/ncD9H/

sodiumnitrate
  • 2,899
  • 6
  • 30
  • 49
  • Do you have multiple instances of `gallery`? please provide more of your code...or better yet, a [jsfiddle](http://jsfiddle.net). – Dom Aug 19 '13 at 21:56
  • 2
    I tried your code snippet on jsfiddle using Firefox and I get a count of 3. – Shamim Hafiz - MSFT Aug 19 '13 at 21:57
  • 2
    did you try disabling all plugins on firefox? – Neil S Aug 19 '13 at 21:59
  • Here's a [fiddle](http://jsfiddle.net/GYatesIII/YPP3y/) Where I'm getting 3 using your code in Firefox. Have you extended the array prototype at all? – George Yates Aug 19 '13 at 21:59
  • jsfiddle: [link](http://jsfiddle.net/ncD9H/) – sodiumnitrate Aug 19 '13 at 22:07
  • @GeorgeYates I am new to js and jquery, so I don't know what you mean by extending the array prototype. – sodiumnitrate Aug 19 '13 at 22:09
  • If that's your only code, you're not [extending the prototype](http://stackoverflow.com/questions/3781373/javascript-what-are-extend-and-prototype-used-for). [Here's](http://jsfiddle.net/GYatesIII/ncD9H/1/) a very slightly modified version of your fiddle. Do you see 51 after "Count"? I see 3 in Firefox still. – George Yates Aug 19 '13 at 22:17
  • In firefox I see 3 in the most recent fiddle. – sodiumnitrate Aug 19 '13 at 22:18
  • You've just gained access to Area 51 in firefox, and will be arrested shortly. Delete your code and run like hell ! – adeneo Aug 19 '13 at 22:23
  • It worked. I've changed nothing but suddenly it worked. Maybe I did change something without noticing, but when I refreshed the page it was working. Sorry for the trouble, and thank you all. – sodiumnitrate Aug 19 '13 at 22:24

0 Answers0