Thanks for your quick answer. I accessed your link. This time both length and size() gives me the same result but incorrect count 4. There are only three elements with attribute "name" butI still get 4 count. However, the same works fine in IE 7 & 8. Please note that I have IE 6.0.* installed on Windows 2000 Professional Edition operating system.
Thanks Chirag On Tue, Jul 21, 2009 at 7:29 PM, John Resig <jere...@gmail.com> wrote: > Using your demo page I'm getting '3' for both .length and .size() in IE 6 > and in Firefox. > http://ejohn.org/files/bugs/name-attr/ > > --John > > > > On Tue, Jul 21, 2009 at 9:25 AM, Chirag <chiragp...@gmail.com> wrote: > >> >> Hello, >> >> Recently when I was doing some testing, I found issue with length >> property. The size() method returned correct value but the length >> method returned incorrect value. >> >> I used the mark up below to test my code. >> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >> "http://www.w3.org/TR/html4/loose.dtd"> >> <html> >> <head> >> <title>Selector Demo 2</title> >> <script type="text/javascript" src="jquery-1.3.1.js"></script> >> <script> >> $(document).ready(function(){ >> $('#btnNameAttr').click(function(e) { >> $('#log').html('# of elements having >> attribute [name] : ' >> + $('[name]').length); >> }); >> }); >> </script> >> <style> >> body { font-size:16px; font-weight:bolder; } >> #main { >> margin: 10px 10px; >> } >> </style> >> </head> >> <body> >> <div> >> <textarea rows="3" cols="50" id='log'></textarea> >> </div> >> >> <div class="top"> >> <div class="first second"> >> First >> </div> >> <div class="first second"> >> Second >> </div> >> <div class="first"> >> Third >> </div> >> <input type='text' name='textbox' /> >> <input type='hidden' name='hidden' /> >> <input type='hidden' name='hidden' sortorder='DE SC' /> >> <br /> >> <input type="button" id="btnNameAttr" value="$('[name]')" >> /> >> <input type="button" id="btnCustomAttr" >> value="$('[sortorder]')" /> >> <input type="button" id="btnAttrValue" >> value="$('[sortorder=DE >> SC]')" /> >> <input type="button" id="btnHiddenNameAttr" value="$ >> ('[name=hidden]')" /> >> </div> >> >> </body> >> </html> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---