jQuery id Selector

Last Updated Jul 21, 2015, 12:00:06 PM

jQuery id Selector

jQuery id selector uses the id attribute of a HTML tag to find the specific element on the webpage.

HTML id should be unique within a page. Use the id selector when you want to find only a single or unique element.


Lets say if there 4 p elements on the webpage but you want to select or target only a specific HTML element you can simply target that element by giving a unique name as its id name


In the above example code, we have a paragraph with an id called myid. Using the below jquery id selector we can simply target that myid element and apply the required styles we need.


When you click on button, the element with id=myid will be hidden:

jquery id selector
Try It Now

Other Advanced jQuery Selectors you might want to learn

jQuery Complete Selectors Reference

jQuery Selectors

jQuery Basic Selectors

jQuery Child Selectors

jQuery Content Filter Selectors

Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 21, 2015, 12:00:06 PM