html - what's the difference between $('.p') and $('p') jquery? -
i'm new jquery, when select class html, can $('.p')
or $('p')
. i'm confused, there difference?
these css selectors. can used in jquery is.
$('.p')
class selector. select elements having classp
.in html document, css class selectors match element based on contents of element's class attribute. class attribute defined space-separated list of items, , 1 of items must match class name given in selector.
example:
<a class="p">...</a> <div class="p anotherclass">...</div> <span class="firstclass p">...</span> <p class="p">...</p>
$('p')
element/tag/type selector. selectp
(paragraph) elements.css type selectors match elements node name. used alone, therefore, type selector particular node name selects elements of type — is, node name — in document.
example:
<p>...</p> <p class="anyclass">...</p> <p id="anyid">...</p>
also, there id selector.
$('#p')
select element having id ofp
.in html document, css id selectors match element based on contents of element's id attribute, must match value given in selector.
example:
<anyel id="p">...</anyel>
Comments
Post a Comment