Skip to content Skip to sidebar Skip to footer

Determine Which Area In A Map (imagemap) Was Clicked Using Javascript (or Jquery)

I'm writing a mock up (using HTML, JS/jQuery) and CSS for a client which involves having a single image (of an interface) with an Map applied to it. For reasons I won't explain whe

Solution 1:

There are different approaches. I guess the easiest would be this one:

$("map[name=claas_ipad3] area").live('click', function () {
    alert($(this).attr('id')); 
});

Note that as of jQuery 1.7, the .live() method is deprecated and you should use .on() to attach event handlers:

$("map[name=claas_ipad3] area").on('click', function () {
    alert($(this).attr('id')); 
});

Post a Comment for "Determine Which Area In A Map (imagemap) Was Clicked Using Javascript (or Jquery)"