$('a.stop').click(function() { var input_id = $(this).prev().attr("id"); var parent_id = $(this).parents("div:first").attr("id"); $('#'+parent_id).hide(); }
On May 12, 8:48 am, heohni <heidi.anselstet...@consultingteam.de> wrote: > hi! > > I have this construct: > <div id="box_vfo"><input type="text" name="neu_vfo" id="neu_vfo" > class="textInput"><a href="#stop" class="stop"><img src="../img/ > delete_edit.gif" alt="" width="16" height="16" border="0"></a></div> > > On click I want to hide the div and empty the input value: > $('a.stop').click(function() { > var parent_id = $(this).parents("div:first").attr("id"); > $('#'+parent_id).hide(); > ... > > How can I find out the id of the input field if I don't know it? > I don't think the input can be found with parents, or? > > Thanks for help!!