The ':reset Selector' is used to select all the input elements with type="reset".
Say, for example, if you want something to be entered by the user.
And HTML uses the <input> element to achieve the above.
Also the <input type="reset"> creates a reset button that resets all the values to the initial values.
Let us learn more with the below example.
<html>
<head>
<title> My First Programme </title>
</head>
<body>
<h1> JQuery </h1>
<form >
<span> Enter User :: </span>
<input type = "text">
<br/>
<span> Enter Password :: </span>
<input type = "password">
<br/>
<input type = "reset">
<br/>
</form>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"> </script>
<script>
$(':reset').css("background-color", "green");
</script>
</body>
</html>
So, if you see the above code. We can see that there are three input elements.
<input type = "text"> <input type = "password"> <input type = "reset">
And we want to highlight the color of those input elements that has 'type = "reset"'(Using 'css()' function provided by JQuery).
And we can see that there is one <input> element that has 'type = "reset"'.
Thus the contents of,
<input type = "reset">
Gets changed.
And this happened with the ':reset' element selector.
$(':reset').css("background-color", "green");And the JQuery code locates the input element of type submit and changes the color to green.