$("input.saveButton").click(function () { alert( $(this).parent().find('input:first').val() ); });
or $("input.saveButton").click(function () { alert( $(this).siblings('input').eq(0).val() ); }); On Dec 16, 9:33 am, Karl Delandsheere <[EMAIL PROTECTED]> wrote: > Hi! > > Did you try this: > > $(document).ready(function () { > $("input.saveButton").click(function () { > > var parent = this.parentNode; > alert(parent); > > }); > }); > > And if you want to get the jQuery object, $(this.parentNode). > > Anyway, you have the "parents()" method. > > Hope that I helped :). > > On Dec 16, 6:20 am, "Nguyễn Quốc Vinh" <[EMAIL PROTECTED]> wrote: > > > I have this followwing form: > > <form name="editor" action="index.php" method=POST> > > <nput type=text name="id" value="100" /> > > <nput type=text name="title" value="cat title" /> > > <input type=button class="saveButton" name="Save" value="Save" /> > > > </form> > > I want whenever user clicks on Save Button, it will select the parent > > element of button(in my case, it is FORM element), > > then get the value of first input box in form! > > I tried this but it's not working: > > > $(document).ready(function () { > > > $("input.saveButton").click(function () { > > var i=$("../form/input:eq(0)",this).val(); > > alert(i); > > > }); > > > }); > > > Coud anyone show me a solution? > > -- > > /******************************************** > > * Người ta thưởng chỉ chú ý đến những kẻ lên như diều gặp gió! Nhưng hỡi ôi, > > chỉ có cát, bụi và lông hồng mới là những thứ lên nhanh nhất > > */