Home >>jQuery Tutorial >jQuery :input Selector

jQuery :input Selector

jQuery :input Selector

jQuery :input selector in jQuery is used to selects form elements and also works with the button element.

Syntax:
$(":input")
Here is an Example of jQuery :input Selector:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(":input").css("background-color", "#e686eb");
});
</script>
</head>
<body>
<form action="">
Name: <input type="text" name="user"><br>
Password: <input type="password" name="password"><br>
<button type="button"> Button</button>
<input type="button" value="Button1"><br>
<input type="reset" value="Reset">
<input type="submit" value="Submit"><br>
</form>
</body>
</html>

Output:
Name:
Password:



No Sidebar ads