I
Insight Horizon Media

How to enable or disable any control using jQuery?

Author

Sarah Cherry

Published Feb 20, 2026

How to enable or disable any control using jQuery?

Here use the jQuery Prop Method to enable or disable any control. To disable any control with jQuery pass true as the second argument to the .prop () method. There is an input control and a button. On the button click event I will disable the input control.

How to disable/enable form elements in jQuery?

Sometimes you need to disable/enable the form element like input or textarea. Jquery helps you to easily make this with setting disabled attribute to “disabled”. For e.g.: To enable disabled element you need to remove “disabled” attribute from this element or empty it’s string.

How to change the disabled property of the input in jQuery?

jQuery 1.6+. To change the disabled property you should use the .prop() function. $(“input”).prop(‘disabled’, true); $(“input”).prop(‘disabled’, false);

How to disable selected value from select but post it?

The best solution for me was such an ugly trick $ (“#dropdownDepartment”).prop (‘disabled’,true).trigger (‘chosen:updated’).prop (‘disabled’,false). So chosen is disabled but value from select is POSTed. There are a few options you could do. Disable the drop down and store the value in a hidden field and send that in a POST.

How to set the value of input element in jQuery?

There is a Input Element, the task is to set its value using JQuery. Here are a few examples discussed. To understand example first few methods to know. JQuery val () method: This method return/set the value attribute of selected elements. If we use this method to return value, it will return the value of the FIRST selected element.

How to disable any control with jQuery pass false?

To disable any control with jQuery pass true as the second argument to the.prop () method. 1 $ (“#id”).prop (“disabled”, true) Similary, to enable any control with jQuery pass false: