The ':submit Selector' is used to select all the input elements with type="submit".
Say, for example, if you want something to be entered by the user.
And HTML uses the <input> element to achieve the above.
Also there is something called 'form' in HTML. You can fill the form and submit it. And we will be dealing with type="submit".
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 = "submit"> <br/> </form> <script src = "https://cdnjs.cloudflare.com/ajax/libs/JQUERY/3.3.1/jquery.min.js"> </script> <script> $(':submit').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 = "submit">
And we want to highlight the color of those input elements that has 'type = "submit"'(Using 'css()' function provided by JQuery).
And we can see that there is one <input> element that has 'type = "submit"'.
Thus the contents of,
<input type = "submit">
Gets changed.
And this happened with the ':password' element selector.
$(':submit').css("background-color", "green");
And the JQuery code locates the input element of type submit and changes the color to green.