w3resource
jquery exercises

jQuery: Find all input elements that are enabled

jQuery Fundamental - II : Exercise-84

Find all input elements that are enabled.

Sample solution :

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Find all input elements that are enabled.</title>
</head>
<body>
<form>
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname" disabled><br>
</form>
</body>
</html>

JavaScript Code :

$( "input:enabled" ).val( "This element is enabled.");

See the Pen jquery-fundamental-exercise-84 by w3resource (@w3resource) on CodePen.


Contribute your code and comments through Disqus.

Previous: Finds all elements that are empty.
Next: Selects all paragraphs and finds span elements inside these and reverts the selection back to the paragraphs.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming