Consider the following HTML
<fieldset>
<legend>FOO</legend>
<div> <!-- this is not static code...it's generated by jQuery-->
<input type="checkbox" id="chkBox" />
</div>
</fieldset>
When I run this jQuery
console.log($("#chkBox").parent());
I get [Fieldset]
instead of the expected [div]
...and I have no idea why!?
EDIT: Just a quick point here...the <div>
tag is being generated by jQuery...so in reality, the fieldset IS the parent (hard-coded)...so how would I get the dynamically created parent?