Net-informations.com
SiteMap  | About    

How do I disable/enable a form element?



Sometimes you need to enable or disable input elements or form elements in jQuery. In such cases, you can use jQuery prop() method to disable or enable input elements/form elements dynamically using jQuery.

example

Full Source

jQuery 1.5 and below

The jQuery .prop() method doesn't exist jQuery 1.5 and below , in such cases you can use jQuery .attr() method .

It is important to note that, you can always rely on the actual DOM object and is probably a little faster than the above two options if you are only dealing with one element:

JavaScript

In JavaScript you can use the following code to disable/enable an element.

The disabled property sets or returns whether a text field is disabled, or not.










net-informations.com (C) 2019    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.