Hi,
how can i select the second Tag?
$("head > style:nth-child(2)").html();
Thanks in advance.
Peter
Hi,
how can i select the second Tag?
$("head > style:nth-child(2)").html();
Thanks in advance.
Peter
If your html looks like this for example:
<div id="container">
<span id="span1"></span>
<span id="span2"></span>
</div>
Your script:
var secondChild = $('div#container > *:eq(1)');
Where on eq(n)
: n
is the zero-based index of the child you want to get. In this case, 1
points to the second child of <div>
.
See more info here: http://api.jquery.com/eq-selector/
... i do not know if this is possible. You cannot select any non-body elements using CSS, so i'm guessing you cannot either using jQuery.
What do you want to do exactly?