Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable control using jQuery

Tags:

I want to disable control on click for this i have added attr to the control 'disabled' and it is working fine in IE but not in Firefox. The code i have written is

$(obj).attr('disabled','disabled'); 

If I am missing something then please give me idea.

like image 204
munish Avatar asked Apr 28 '11 10:04

munish


People also ask

Is button disabled jQuery?

Checking if the button is disabled or enabled with jQuery removeAttr('disabled'); }; const checkButton = (e) => { const isDisabled = $('#my-button'). prop('disabled'); if( isDisabled ){ alert("Is disabled!"); } else{ alert("Is enabled"); } }; $(document).

How do I disable a particular element in a form?

To disable all form elements inside 'target', use the :input selector which matches all input, textarea, select and button elements. $("#target :input"). prop("disabled", true); If you only want the elements, use this.


2 Answers

$(obj).attr('disabled', true); 
like image 83
Alex R. Avatar answered Sep 29 '22 20:09

Alex R.


Try this

$(obj).attr("disabled","disable") 

note value of attribute "disabled" is "disable" not "disabl*ed*"

like image 38
Chinmayee G Avatar answered Sep 29 '22 22:09

Chinmayee G