How to enable/disable a button using jQuery ?
The property values can be explicitly retrieved using the prop() method. The prop() method only returns the property value for the first matching element in the set. For a property whose value hasn’t been set, or for a matched set that does not contain elements, it returns Undefined.
The selected element’s boolean attribute can be set to true or false using this method.
The function returns a boolean value. Whenever the selected element contains a boolean attribute (disabled, checked), it returns true otherwise.
What is a disabled attribute?
This is a boolean attribute that indicates the element should not be displayed. It is unusable to use an element that is disabled. You can set the disabled attribute to prevent the element from being used until another condition is met (such as checking a box).
Example: When you click the button below, the button above is disabled, and when you double click the button below, the button above is enabled. The prop is applied in this example to demonstrate how it is used correctly and how it can be applied.
Please Login to comment...