How to Disable Every Form Elements Using jQuery

In this tutorial, learn how to disable every form elements using jQuery. The short answer is: use jQuery prop() to disable all form controls in jQuery. The user cannot be able to click the form elements after you disable them.

First of all, you can use jQuery to enable or disable form elements easily. While developing forms, many times maybe you come up with a problem to stop user input. Therefore, After fulfill of certain requirements, you may allow users to enter input data.

How to Disable Every Form Elements Using jQuery

With the above all requirement, you have to use the prop function with two arguments. The first argument is the attribute to add the HTML element. The another argument is the value of the attribute to be true.

As a result, the true value makes all the input to become disabled. You are almost done disabling all input fields of form.

Output








Finally, take your mouse to any input fields including the button element. So, All the inputs are in disable condition. Due to this, you are not allowed to click any input field and enter data.

Also, take your mouse to each and every form elements. This is the simple method to disable every form elements.

Stop allowing users to input any values in the form. You may also like to read how to display or show form on button click using jQuery.

Hope, you like this tutorial of how to disable every form elements. If you have any query regarding the tutorial, please comment below.

Also tell me, which method are you using to disable form controls.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.