I have an image map with various areas on it. A user can click on the various areas and something happens. That said, I sometimes need to disable the ability to click on some areas. For instance areas whose id attribute contains 0 0. I have the code to split the id and grab whether the values are 0 or 1 and the alert pops up when one has 0 0 in the id but it's still clickable. I thought .unbind would do the trick, but it isn't. the alert is simply for testing.
Any help would be much appreciated.
Thanks in advance,
Twitch
- $('area').each(function()
- {
- // Use the each() method to gain access to each elements id
- var idToDisable = $(this).attr("id");//get id of area
- var splitID = idToDisable.split("_");
- if (splitID[3] == 0 && splitID[5] == 0){
- alert(splitID[3]+splitID[5]);
- $(this).unbind('click');
- }else{
- }
- });