Posted inAll / Javascript

disable and enable form element using jquery

Using Id:

To Disable the Element:

jQuery('#id').attr('disabled','disabled'); //Here id is form element id
To Enable the Element:

jQuery('#id').removeAttr("disabled");

Using Name:

To Disable the Element:

jQuery('input[name="elementname"]').attr('disabled','disabled'); //Here element name is form element name


To Enable the Element:

jQuery('input[name="elementname"]').removeAttr('disabled');

Leave a Reply