Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable span does not work on firefox

how to disable a span using jquery/javascript. The script

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

works fine on IE but doesnt work on firefox.

like image 362
Ankit Avatar asked Feb 24 '23 13:02

Ankit


1 Answers

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

The only thing I can imagine is that you've got some event bindings on that <span>, to remove those you can call jQuerys .unbind(), .die() and/or .undelegate().

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

That would remove any event handler (bound directly or via delegation). The only problem here is, that you would to manually store the event handler functions if you want to "enable" it later on again.

like image 178
jAndy Avatar answered Feb 26 '23 07:02

jAndy