mixing functions such as .find() and .sibling() with selectors such as :parent and the '+' sibling operator
problem: I have this complicated search I want to make via jQuery, I realized that I will have to nest several selectors/functions and I don't know how the syntax works for that.
example:I'm looking to find all input fields that exist in tab(i) that are adjacent (or a sibling of) labels that have a span with an 'asterisk' class. Then I want to change the class of that input into "required". I have potentially hundreds of such input fields and as such it's impossible to refer them by id or whatever.
<div id="identity_form" class="standardForm" name="identity" method="post" action="/credentials.php">
<label for="FirstName"><span class="asterisk">*</span>First Name</label>
<input type="text" class="" id="FirstName" name="FirstName" maxlength="48" value="" />
i tried this:
but it just didn't work.
explanation: I found this kind of nesting in the web:
the problem is that jQuery has :has, :parent but it doesn't have something like :sibling, I will have to use + operator..
question: How can I use the '+' sibling operator in conjunction with functions like .find() etc