Is it possible to click a portion of an image map and print out some text, be it the alt
or title
value of that <area>
tag somewhere on the page?
Could I do this through jQuery? I've looked and I'm struggling to do so (very rusty with jQuery, and a novice on top of it). I've played with a bit of code but all I manage to get is static data out.
Thanks.
Edit: This is one large image with 30 uniquely sized and shaped "areas" that are clickable.
HTML:
<map name="Map" id="Map">
<area shape="rect" coords="32,36,222,109" href="#" alt="hi" />
<area shape="rect" coords="246,45,420,110" href="#" alt="alt" />
<area shape="rect" coords="456,45,585,111" href="#" />
<area shape="rect" coords="627,44,768,118" href="#" />
</map>
jQuery:
<script type="text/javascript">
$(function(){
$('map area').click(function(){
alert($(this).attr('alt'));
});
});
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With