The jQuery selectors let us quickly and easily access individual or groups of HTML elements in the Document Object Model (DOM). Selectors allow you to get the exact element or attribute you want from your HTML document.
jQuery supports the existing CSS Selectors, as well as some custom selectors. All of the jQuery selectors begin with the dollar sign and parentheses: $().
The selectors are very useful and would be required at every step while using jQuery. They do a great job making it easy to get to the exact element that you want from your HTML document.
Here is an example where you are selecting all paragraph elements and when you click on any of them, the text color changes to red. If you copy and paste this example, make sure you update the correct value for the src attribute in the reference to the jQuery library.
This is a paragraph.
This is second paragraph.
This is third paragraph.
<script type="text/javascript">
$(document).ready(function () {
$("p").click(function () {
$(this).css("color", "red");
});
});
</script>