How To Disable All Input Controls Inside A Form Using JQuery

TutorialRepublic HOME HTML5 CSS3 JAVASCRIPT JQUERY BOOTSTRAP5 v4.6 PHP7 SQL REFERENCES EXAMPLES FAQ SNIPPETS Online HTML Editor WEB TUTORIALS HTML Tutorial CSS Tutorial JavaScript Tutorial jQuery Tutorial Bootstrap Tutorial PHP Tutorial SQL Tutorial PRACTICE EXAMPLES HTML Examples CSS Examples JavaScript Examples jQuery Examples Bootstrap Examples PHP Examples HTML REFERENCES HTML Tags/Elements HTML Global Attributes HTML Event Attributes HTML Color Picker HTML Language Codes HTML Character Entities HTTP Status Codes CSS REFERENCES CSS At-rules CSS Properties CSS Animatable Properties CSS Color Values CSS Color Names CSS Web Safe Fonts CSS Aural Properties PHP REFERENCES PHP Array Functions PHP String Functions PHP File System Functions PHP Date/Time Functions PHP Calendar Functions PHP MySQLi Functions PHP Filters PHP Error Levels Advertisements How to disable all input controls inside a form using jQuery

Topic: JavaScript / jQueryPrev|Next

Answer: Use the jQuery prop() method

You can use the jQuery prop() method in combination with the :input selector to disable all <input>, <textarea>, <select> and <button> elements inside an HTML form dynamically using jQuery. The prop() method require jQuery 1.6 and above.

Let's check out an example to understand how this method basically works:

Example

Try this code » <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Disable All Form Elements</title> <style> label { display: block; margin-bottom: 5px; } label, input, textarea, select { margin-bottom: 10px; } </style> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $("#myForm :input").prop("disabled", true); }); </script> </head> <body> <form id="myForm"> <label>Name:</label> <input type="text"> <label>Address:</label> <textarea></textarea> <label>Country:</label> <select> <option>select</option> </select> <br> <button type="button">Submit</button> <button type="button">Reset</button> </form> </body> </html>

Related FAQ

Here are some more FAQ related to this topic:

  • How to add attribute to an HTML element in jQuery
  • How to disable or enable a form element using jQuery
  • How to remove the clickable behavior from a disabled link using jQuery
Previous Page Next Page Advertisements Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties Advertisements

Is this website helpful to you? Please give us a like, or share your feedback to help us improve. Connect with us on Facebook and Twitter for the latest updates.

About Us

Our Story Terms of Use Privacy Policy

Contact

Contact Us Report Error Advertise

Interactive Tools

Bootstrap Icon Search Utility HTML Formatter Title & Meta Length Calculator HTML Color Picker Bootstrap Button Generator SQL Playground Font Awesome Icon Finder HTML Editor

TutorialRepublic

BMC Copyright © 2025 Tutorial Republic. All Rights Reserved. Share This:

Từ khóa » Html Form Block Input