select nth child like this I want to select seconds child .
$(this).prev().children[1].removeClass("necry").addClass("necry_er");
And this HTML
<div class="reg_label">
<div class="def">Family</div>
<div class="necry">Necessary Field</div>
<div class="clear"> </div>
</div>
I expect this result:
<div class="necry_er">Necessary Field</div>
what about something like this?
Use eq() to reduce a set of matched elements to the one at the specified index.
There's also a :nth-child selector:
To just swap the two classes you can do:
How exactly to go about finding the element you want is a little hard to tell, as there is no explanation as to what
this
is or what context it is in ?