When working with class / identifier selectors in CSS and in jQuery, I often see two different approaches:
1. Just a class or id:
CSS
.foo{}
#bar{}
JQuery
$(".foo")
$("#bar")
2. Class or identifier with its tag:
CSS
div.foo{}
div#bar{}
JQuery
$("div.foo")
$("div#bar")
My question is: prohibiting the use of a tag for further refinement of the selector, is there something wrong with placing the tag with the / id class? What is the correct syntax?
I have heard some who say that if a tag is not needed for specificity, it is not like that to put it. While others say it doesn't make any difference, and actually prefers it, as it provides additional information regarding the selector.
What do you think?