MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

jQuery Selectors: An jQuery for Beginners

What is Selectors?

JQuery statement with the $ selector part and the method part labeled

The document we have written in blue text with $ is called selectors.

JQuery $(document) selector highlighted as the selector part of the statement

And what is in the right side of the document, we call it method

JQuery statement showing the method on the right side of the selector

Our selector part is written to target the dang of HTML or to select the dang element.
And after selecting you do the work you want to do in the method.

In this blog, the part which you select is learned in detail.

Which is our selector part, it basically consists of CSS selectors,

Basic jQuery selectors by id, class and tag name: $(#id), $(.class), $(p)
These were our basic selectors

And which are basic selectors like -> Id, Class, Tag Name.
If you want to target an HTML element with id, then you can write for it as if we are showing the image above.

For ID
For Class
For Tag

These were our basic selectors apart from this, there are also advance selectors

Advance selectors

Table of advanced jQuery selectors, starting with $(*) to select all elements

$(“*”) Advance selector gets first star (*) tag

Star means all the tags written inside HTML, if you want to target all of them within a page, or want to do CSS like that if you want to pink their HTML, then you can put star tags.

Example for Id:

JQuery example code that selects an element by id and changes its style

Result:

Browser result of the jQuery id selector example with the targeted element styled

Example for <li> Tag:

JQuery code example using an ID selector to style an element

Result:

Browser result of the jQuery ID selector example showing the styled element

Example for Class Tag:

JQuery code example selecting li tags to style list items

Result:

Browser result of the jQuery li tag selector example with styled list items

Example for (*) Star Tag:

JQuery code example using the star selector to target all elements

Result:

Browser result of the jQuery star selector applying styles to every element on the page

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

What is Jquery and use cases of Jquery?

What is Jquery? Jquery is a fast and concise JavaScript library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. It…

Read More

What is Jquery and How it works? An Overview and Its Use Cases

What is jQuery? jQuery is a fast and concise JavaScript Library created by John Resig in 2006 with a nice motto: Write less, do more. jQuery simplifies HTML…

Read More

Top 50 interview questions for JQuery

The JQuery is a wild, minor, and feature-rich JavaScript library. It brands things like HTML document traversal and operation, event handling, animation, and Ajax much humbler with…

Read More

Laravel – select dropdowns that filter results in a table ‘on change’

Hello, I am working on an application that is kind of an eCommerce application that have a table of product and I want to add a filter…

Read More

DataTables images issues like sort_asc.png & sort_both.png not found

Hi Friends, I am facing these issues for the last 1 month so I decided to solve this issue then I tried and I succeed. this is…

Read More

How to Use Dropdown Search Functionality with Pagination in Laravel PHP Framework?

Step 1. Firstly, add dropdown in blade file according to below code,here mention name=”city_filter” and id id=”city_filter” step 2:pass id in table tag in step 3: write…

Read More