
- 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 :reset Selector
The :reset selector in jQuery is used to select the input and button elements with type = "reset".
For instance, "$('input:reset')" would select all input elements that have type = "reset, but not the button elements.
Syntax
Following is the syntax of :reset selector in jQuery −
$(":reset")
Parameters
- ":reset" − This selector will select all reset buttons within the entire document.
Example 1
In the following example, we are using the ":reset" selector to select all the <input> elements with type = "reset" −
<html> <head> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function(){ $(":reset").css("background-color", "red") }); </script> </head> <body> <form> <input type="text" name="username" placeholder="Enter username"> <input type="reset" value="Reset"> </form> </body> </html>
When we execute the above program, the input element with type = "reset" will be highlighted with red background.
Example 2
In this example, we are using the ":reset" selector to select the <button> element with type = "reset" −
<html> <head> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function(){ $(":reset").click(function(){ alert("Reset button clicked!"); }); }); </script> </head> <body> <form> <input type="text" name="email" placeholder="Enter your email"> <button type="reset">Reset</button> </form> </body> </html>
After executing the program, an alert will be displayed after clicking the button element with type = "reset".
jquery_ref_selectors.htm
Advertisements