I am trying to learn jquery and have a question -
The div element on the page looks like -
<div id ="1">
<p id="first"> one
<p id="second"> one.one
<p id="third"> one.one.one </p>
</p>
</p>
</div>
Both the below selectors are giving me the same result -
$('div p').css({'background-color' : 'blue'});
$('div>p').css({'background-color' : 'blue'});
Shouldn't the second selector just return only the first <p>
tag of the <div>
element ?
` tags' closing tag is optional. Your code is being parsed as `
one
one.one
...`. Docs: http://www.w3.org/TR/html-markup/p.html#p-tags