How to Use JQuery Selectors?

A jQuery selector is a string that specifies which HTML element to select. The selector string is passed to the $ () or jQuery () selection function.

Complete List of jQuery Selectors, Understanding jQuery Selectors, Use JQuery Selectors With Example

You must remember that you use them to find or select HTML elements. In addition, it also depends on the values ​​of names, classes, IDs, characteristics, types and properties. Also, it finds base in css selectors.

JQuery selector syntax is similar to CSS selectors, if you are familiar with CSS selectors, you can learn jQuery selector very quickly.

Selectors in jQuery are the most important aspect of the jQuery library. These selectors use syntax in CSS so that developers can easily select and work on any set of page elements. Understanding jQuery selectors most effectively jQuery The key is to use the library

Types of Selector

  1. Element selector
  2. .class selector
  3. #id selector
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
</head>
<body>
<h2>This is My First Heading of Experts PHP.</h2>
<p>This is My First paragraph of Experts PHP.</p>
<p>This is another paragraph of Experts PHP.</p>
<button>Click Me And Hide</button>
</body>
</html>