Jquery hiding images with parent class -
consider html:
<span class="leaguetogglehome"> <img src="/images/formleagueall.png" id="up" class="homeleagueswitch" /> <img src="/images/formleague.png" id="down" class="homeleagueswitch" /> </span>
i want hide 1 of 2 buttons using jquery:
$('span.leaguetogglehome img#up').hide(); $('span.leaguetogglehome img#down').hide();
what happens 2 other images 'up' , 'down' id's hidden instead. in container of different class, why hidden , not 2 intend hide. have included class of parent contain button si want hide.
this makes no sense it?
the 'other' img tag:
<span class="toggle" id="home"> <img src="/images/formhomeup.png" id="up" class="hometoggleresults"/> <img src="/images/formhomeoverallup.png" id="down" class="hometoggleresults"/> </span>
according w3, id
supposed unique per html page.
here's jquery says selecting id:
each id value must used once within document. if more 1 element has been assigned same id, queries use id select first matched element in dom. behavior should not relied on, however; document more 1 element using same id invalid.
so i'm guessing "other img tag" appears in dom before 1 you're attempting modify?
Comments
Post a Comment