Disabling a type="image" input won't work on Firefox

Viewed 29

I am trying to disable a button I made for a game. When I open the game in all the other browsers, the button is disabled. But, when I open the game in Firefox, the button is not disabled. If I switch the input type to "button", the button disables. Here is the code:

<input type="image" src="mapIcon.png" alt="mapIcon" class="mapIcon" id="mapIcon" onclick="openMap()" disabled>

1 Answers

This question is a dupe, but found the answer within 5 seconds of searching.

https://stackoverflow.com/a/3447442/19447792

document.getElementbyId(ID).setAttribute('disabled', true|false); Works on IE/FF/GC

So:

<input type="image" src="mapIcon.png" alt="mapIcon" class="mapIcon" id="mapIcon" onclick="openMap()">

<script>
#disable
document.getElementbyId('mapIcon').setAttribute('disabled', true);

#enable
document.getElementbyId('mapIcon').setAttribute('disabled', false);
</script>
Related