I have an image map and would like to be able to show/hide a div based on which item in the image map I click?
html...
A similar answer was posted by someone else. I'm not sure why it was deleted. It appears to work:
$('[item="texas"]')
Here's an example:
You clicked the Republic of Texas!
You clicked Florida!
$('[item="texas"]').click(function(){
$(".display").hide();
$("#texas").show();
return false;
});
$('[item="florida"]').click(function(){
$(".display").hide();
$("#florida").show();
return false;
});
http://jsfiddle.net/xtKXL/5/
To make things a little more dynamic, you can grab the "item" from the http://jsfiddle.net/xtKXL/6/ over which you're hovering and use that value to display the appropriate
$('[item]').click(function(){
var item=$(this).attr('item');
$(".display").hide();
$("#"+item).show();
return false;
});