Library - JQuery

Back to Course

Lesson Description

Lession - #557 JQuery Selectors

What are the selectors in JQuery?
jQuery selectors are used to "find" (or select>
HTML elements based on their name, id, classes, types, attributes, values of attributes and lots more. It`s based on the existing CSS Selectors, and in addition, it has a few own custom selectors.

Every jQuery selector begin with thiis signal $(>
. This signal is called the factory function. It makes use of the 3 primary building blocks while choosing an detail in a given document.

Tag Name:
It represents a tag call available in the DOM.

For example: $(`p'>
selects all paragraphs'p'in the document.

Tag ID:
It represents a tag available with a selected ID withinside the DOM.

For example: $('#real-id'>
selects a specific element withinside the document that has an ID of real-id.

Tag Class:
It represents a tag to be had with a specific class in the DOM.

For example: $('real-class'>
selects all elements in the document which have a class of real-class.


 <title> jQuery Example</title>  
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">  
 <script type="text/javascript" language="javascript">  
{ $("p">
.css("background-color", "green">
; }>
; </script> </head> <body> <p>techedhub.com.</p> </body> </html>
Try it here