How to disable all <input> inside a form with jQuery?
In this tutorial, we are going to see how to disable all <input> inside a form with jQuery? You can simply use the method pro() of jQuery with the selector :input to disable all <input>, <textarea>, <select>, and <button> tags from an HTML form dynamically using jQuery. The pro() method requires a jQuery > 1.6 version.
How to disable all <input> inside a form with jQuery?
<!DOCTYPE html>
<html>
<head>
<title>disable all input inside a form</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#myform :input").prop("disabled", true);
});
</script>
</head>
<body>
<form id="myform">
Username:<br>
<input type="text" name="username">
<br>
Email id:<br>
<input type="text" name="email_id">
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
| Result |
|---|




