Get element with CSS class name or id with jQuery, jQuery is extremley powerful and a time (and even life) saver, using jQuery, you can get elements with CSS class name and id easily without too much blood and tears!
How to Get element with CSS class name or id with jQuery
For example, ID: #idA
$(‘#idA’) – would select all elements that have an id of ‘idA’, regardless of its tag name.
$(‘div#idA’) – would select all div elements that have an id of ‘idA’.
And when using Class: .classname
$(‘.classA’) – would selects all elements that have an class name of ‘classA’.
$(‘div.classA’) – would select all div elements that have a class name of ‘classA’.
Here is a complete example;
This Post Has 3 Comments
Nice post. I was checking constantly this blog and I am impressed! Extremely helpful information specifically the last part 🙂 I care for such information a lot. I was looking for this certain information for a very long time. Thank you and good luck.
Hey, thanks for the post. I’m working on a programming-bug research project with Utah State University called, “The Bug Theater,” but ran into some bugs with getting a class (I’m very new to jQuery). Realized I forgot the “.” after scrutinizing your tutorial. Thanks for helping me figure out what my bug was! 😉
Glad I could help!