views:

632

answers:

1

I'm trying to disable an image map onClick - and eventually I'd like to enable it if reclicked, but first things first.

So to disable the imaeg map I'd like to remove the attribute "usemap" from the image when one clicks on the map.

In the header I'm calling my JQuery:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"&gt;&lt;/script&gt;
 <script type="text/javascript" src="jq/jquery.maphilight.js"></script>
 <script>
 $(function() {
  $('.map').maphilight();
 });
</script>

And below I'm attempting to use the .removeAttr but I'm getting no return:

    <div class="mapholder"><img class="map" src="img/map.png" width="517" height="352"    border="0" usemap="#usa"  /></div>
    <script>
  $("img.map").toggle(function(){
 $(this).removeAttr("usemap")
  .focus() 
},
function(){
$(this).addAttr("usemap")
  .focus()
  });
</script>

Here is the test site: http://quiznosforsale.com/open_house/

The map is at the bottom, any suggestions would be highly appreciated!

+1  A: 

try:

$("img.map").toggle(function(){
 $(this).removeAttr("usemap")
  .focus() 
},
function(){
$(this).addAttr("usemap")
  .focus()
});
Reigel
So I've put your code here - but I'm still having the same issue.<div class="mapholder"><img class="map" src="img/map.png" width="517" height="352" border="0" usemap="#usa" /></div><script>$("img.map").click(function () { $("img.map").toggle(function(){ $(this).removeAttr("usemap") .focus() },function(){$(this).addAttr("usemap") .focus()});});</script>
Michael Sacca
Maybe I put it together wrong? - thank you for your help.
Michael Sacca
I updated it in the question so it was easier to read
Michael Sacca