[jQuery] Script not recognizing class
Hey, I am absolutely puzzled and am hoping some of you may be able to
help me:
I have the following HTML:
<ul id="imagenav">
<li > <a href="image_01.jpg" title="1" class="current"
class="notloaded">1</a></li>
<li > <a href="image_02.jpg" title="2" class="other"
class="notloaded">2</a></li>
<li > <a href="image_03.jpg" title="3" class="other"
class="notloaded">3</a></li>
<li > <a href="image_04.jpg" title="4" class="other"
class="notloaded">4</a></li>
<li > <a href="image_05.jpg" title="5" class="other"
class="notloaded">5</a></li>
</ul>
and the following script:
$("#imagenav a").click(function(){
if($(this).hasClass("notloaded")){
alert('class here');
} else {
alert('class not there');
}
});
for some reason, whenever I click on the relevant link the alert
'class not there' pops up, even though I think it's fairly clear it
is.
What am I doing wrong?
Thanks,
Simon