[jQuery] binding click event to area (image map)
Hey Guys,
Not entirely sure what this is not working but have the following code:
js:
$('.optSelectMe').click(function(){
$('.noShowing').addClass('noNakedEye').removeClass('noShowing');
$('#'+$(this).attr('meta')).addClass('noShowing').removeClass('noNakedEye').highlightFade('yellow');
return false;
});
html:
<img src="img/004.jpg" usemap="#Map" class="textLeft" border="0"/>
<map name="Map" id="Map">
<area meta="optA" class="optSelectMe" shape="poly" coords="19,56,59,15,111,3,111,109,19,56" href="#" alt="" />
<area meta="optB" class="optSelectMe" shape="poly" coords="111,109,111,3,160,15,203,55,111,109" href="#" alt="" />
<area meta="optC" class="optSelectMe" shape="poly" coords="111,109,203,55,219,109,203,162,111,109" href="#" alt="" />
<area meta="optD" class="optSelectMe" shape="poly" coords="111,109,203,162,160,204,111,216,111,109" href="#" alt="" />
<area meta="optE" class="optSelectMe" shape="poly" coords="111,109,111,216,59,204,18,162,111,109" href="#" alt="" />
<area meta="optF" class="optSelectMe" shape="poly" coords="111,109,18,162,3,109,19,56,111,109" href="#" alt="" />
</map><br clear="all">
error:
<span class="objectBox objectBox-errorMessage hasTwisty opened">[Exception...
"'Dimensions: jQuery collection is empty' when calling method:
[nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]
even if I do below, I still get the same error:
</span> $('.optSelectMe').click(function(){
$(this)
return false;
});
<span class="objectBox objectBox-errorMessage hasTwisty opened">
I am using v1.2.1, any ideas?
</span>
--
Benjamin Sterling
<a href="http://www.KenzoMedia.com">http://www.KenzoMedia.com</a>
<a href="http://www.KenzoHosting.com">http://www.KenzoHosting.com</a>
<a href="http://www.benjaminsterling.com">http://www.benjaminsterling.com</a>