javascript - jquery selectors problem and efficiency -


hi have problem(not problem, have solved it, @ least interesting) differet bahaviour of jquery selectors in ie(7-8) mobile opera, , other browsers.. here example

<div id="galleryel"><link href="http://designclub.cz/plugins/content/plugin_jw_sig/sig.css" rel="stylesheet" type="text/css">                 <style type="text/css">.sig_cont {width:30px;height:20px;}</style>                 <script type="text/javascript" src="http://designclub.cz/plugins/content/plugin_jw_sig/mootools.js"></script>                 <script type="text/javascript" src="http://designclub.cz/plugins/content/plugin_jw_sig/slimbox.js"></script>                 <div class="sig"><div class="sig_cont"><div class="sig_thumb"><a href="http://designclub.cz/images/stories/hp/hp-falper.jpg" rel="lightbox[sig0]" title="&lt;b&gt;hp-falper.jpg&lt;/b&gt;" alt="hp-falper.jpg" target="_blank"><img src="http://designclub.cz/plugins/content/plugin_jw_sig/showthumb.php?img=hp/hp-falper.jpg&amp;width=0&amp;height=0&amp;quality=0"> 

sorry formatting:)

the problem following..when use selector jquery("#galleryel .sig_thumb a").eq(index); (index integer) in major modern browsers works.. in ie(7-9) (6 ia haven't tested) doesn't..when ie developer console, looks result object kind of plain dom object???i not sure, not skilled in js, seems so:) when change jquery(".sig_thumb a").eq(index); selects right dom element..the markup weird because of it's joomla plugin, using dynamicaly creating background slideshows accroding folder structure..so know wherefrom comes weird behaviour? , second question..i want make efficient, kind of selector best 1 in case?i know when selecting on id, jquery uses js native method, same in case of tagname , on, not sure how combinations if selectors(whether better use id-tag-class-someotherstuff, or id-class-someotherstuff, id-someotherstuff {in case between id , result object many other dom elements}) thank help

be sure there 1 element id "galleryel" . if there more one, depends on ie-version , compatibility-mode if first or last selected.

example testing:

<script  type="text/javascript"> jquery(         function($)         {           alert('found:'+jquery("#someid .someclass").eq(1).text());         } ); </script> <div id="someid"><span class="someclass">1</span></div> <div id="someid"><span class="someclass">2</span><span class="someclass">3</span></div> 

Comments