I often see these 2 selectors, what is the difference? Thanks
+9
A:
This is a ID selector (1)
$("#el")
This is a class selector (2)
$(".el")
So
<div id="el"></div> <-- (1) matches this -->
<div class="el"></div> <-- (2) matches this -->
References
BrunoLM
2010-10-08 23:58:46
+4
A:
# matches an element with that ID. . matches elements with that class.
Ian Henry
2010-10-08 23:58:46
+1
A:
The # version is seeking by tag ID while the . version searches by CSS class.
Andrew Barber
2010-10-08 23:58:47
+2
A:
$("#id") selects element by its id, while $(".class") selects elements by the specified class.
Satoru.Logic
2010-10-08 23:59:06