[jQuery] Parent Selection Problem
Hi all,
I've got the following problem ...
Let's say I have the following html:
<div class="parent" id="parent1">
<div class="sub">
<input id="parent1_Button" class="mybutton" type="button"
value="button" />
</div>
</div>
<div class="parent" id="parent2">
<div class="sub">
<input id="parent2_Button" class="mybutton" type="button"
value="button" />
</div>
</div>
Now given a JQuery object of any of the button, how can I select its parent
div (the one with the class "parent") ?
I have tried the following, but it doesn't seem to yield the correct object:
// This function is wired to the above buttons' onclick event, passing
'this' as an argument
function OnButtonClick(source)
{
var parent = $(".parent").children(source.id);
}
Thanks a lot !
Chris
--
View this message in context: http://www.nabble.com/Parent-Selection-Problem-tf3234532.html#a8987992
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/