I have a html structure like so [list within a list]:
<ul class="outer" >
<li><input type="text" class="outer_name" value="outer_name"></li>
<ol class="inner">
<li><input type="text" value="inner1"><input type="checkbox"></li>
<li><input type="text" value="inner2"><input type="checkbox"></li>
<li><input type="text" value="inner3"><input type="checkbox"></li>
</ol>
</ul>
And I have multiples of these dumped on the page.
I am trying to specify that for each “outer” element, I would like to alert() something as follows:
"outer_name" + "inner1:checked" + "inner2:unchecked" + "inner3:checked"
I have been playing around with an embedded .each function but I cant seem to nail it.
Any help appreciated….
Your HTML is invalid.
ulelements cannot directly containolelements. The only valid child elements ofularelielements.If you fix it:
…then basically: