- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are jQuery Selectors?
A jQuery Selector is a function which makes use of expressions to find out matching elements from a DOM based on the given criteria.
Selectors are used to select one or more HTML elements using jQuery. Once an element is selected then we can perform various operations on that selected element. jQuery selectors start with the dollar sign and parentheses - $(). You can try to run the following code to learn how to work with jQuery Selectors −
Example
<html> <head> <title>jQuery Selectors</title> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function() { $("p").css("background-color", "yellow"); }); </script> </head> <body> <div> <p class = "myclass">This is a paragraph.</p> <p id = "myid">This is second paragraph.</p> <p>This is third paragraph.</p> </div> </body> </html>
- Related Articles
- How does CSS Selectors work in jQuery?
- How to use JavaScript variables in jQuery selectors?
- How to use OR Operation in jQuery Attribute Selectors?
- How to use jQuery selectors on custom data attributes using HTML5?
- How to use wildcards like $ ('#name*'), $ ('#name%') in jQuery selectors?
- What are jQuery string methods?
- What are jQuery AJAX Events?
- What are event attributes in jQuery?
- What are Event Methods in jQuery?
- What are jQuery Event Helper Methods?
- What are jQuery events .load(), .ready(), .unload()?
- Universal Selectors in CSS
- Type Selectors in CSS
- Descendent Selectors in CSS
- Class Selectors in CSS

Advertisements