I am trying to change the href of an a nested in a div called blink3:
$('#blink3 #backLink').attr('href',"#item5");
Where the html code is as follows:
<div style="float:left;text-align:center;" id="blink3">
<a href="#item4" class="panel" id="backLink">
<div class="divBack"></div></a>
</div>
works well in all browsers – NOT IE 7 and I cannot figure out why, doesn’t change the href.
Is this a IE 7 bug? JQuery? anything wrong with my code?
Any solutions?
Nick Craver (omg, where have you been around?) already stated it in a comment. It totally makes no sense to create a selector like
#id #idbecause an ID has to be unique within your DOM by definition.It looks like you break that rule and therefore, jQuery might select a wrong node.
You should replace your “backlink”
id‘s withclassesand go for the selector like