Disable span not working on firefox

how to disable range using jquery / javascript. script

$('#spanid').attr("disabled", 'disabled'); 

works fine in IE, but doesn't work on firefox.

+4
source share
2 answers

You cannot disable a <span> . The disabled attribute only works for input elements. What are you trying to achieve there?

The only thing I can imagine is that you have event bindings to this <span> to remove the ones you can call jQuerys .unbind() , .die() and / or .undelegate() .

 $('#spanid').unbind().undelegate().die(); 

This will remove any event handler (linked directly or through delegation). The only problem is that you have to manually save the functions of the event handler if you want to enable it again later.

+8
source

add this to your css

 [disabled] { pointer-events: none; } 

Browse MDN for browser support. Although IE only recently supported pointer events, adding disabled to span in IE does span not emit click events.

0
source

All Articles