- jQuery - Home
- jQuery - Roadmap
- jQuery - Overview
- jQuery - Basics
- jQuery - Syntax
- jQuery - Selectors
- jQuery - Events
- jQuery - Attributes
- jQuery - AJAX
- jQuery CSS Manipulation
- jQuery - CSS Classes
- jQuery - Dimensions
- jQuery - CSS Properties
- jQuery Traversing
- jQuery - Traversing
- jQuery - Traversing Ancestors
- jQuery - Traversing Descendants
- jQuery References
- jQuery - Selectors
- jQuery - Events
- jQuery - Effects
- jQuery - HTML/CSS
- jQuery - Traversing
- jQuery - Miscellaneous
- jQuery - Properties
- jQuery - Utilities
- jQuery Plugins
- jQuery - Plugins
- jQuery - PagePiling.js
- jQuery - Flickerplate.js
- jQuery - Multiscroll.js
- jQuery - Slidebar.js
- jQuery - Rowgrid.js
- jQuery - Alertify.js
- jQuery - Progressbar.js
- jQuery - Slideshow.js
- jQuery - Drawsvg.js
- jQuery - Tagsort.js
- jQuery - LogosDistort.js
- jQuery - Filer.js
- jQuery - Whatsnearby.js
- jQuery - Checkout.js
- jQuery - Blockrain.js
- jQuery - Producttour.js
- jQuery - Megadropdown.js
- jQuery - Weather.js
jQuery :input Selector
The :input selector in jQuery is used to select all Form elements such as <input>, <textarea>,<select>, and <button> elements. It includes all input-related elements, such as text fields, radio buttons, checkboxes, and more.
Syntax
Following is the syntax of jQuery :input selector −
$(":input")
Parameters
The :input selector will select all the input elements.
Example
In the following example, we are using the jQuery :input elements to select all the form elements −
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
// Change the background color of all input elements
$(":input").css("background-color", "lightblue");
});
</script>
</head>
<body>
<form>
<input type="text" name="textfield" placeholder="Text Field" /><br>
<textarea name="textarea" placeholder="Text Area"></textarea><br>
<select name="select">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select><br>
<button type="submit">Submit</button>
</form>
</body>
</html>
The selected elements will be highlighted with lightblue background color.
jquery_ref_selectors.htm
Advertisements