Thanks, but the page is dynamic and I don't know the names. Any other idea?
I thought I could solve it this way: var top_div = $(this).parents("div").parents("div").attr("class"); var select_name = $('.'+top_div+'>select').attr("name"); But it returns me always the first select name, never the current one :-( What's wrong here? Thanks! On 12 Mai, 16:12, waseem sabjee <waseemsab...@gmail.com> wrote: > working with selects > > $("a.stop").click(function() { > > var obj = $("select"); > for(var i = 0; i < obj.length; i++) { > > if(obj.eq(i).attr("name") == "vfo") { > > // you have found the element do what you need to do > obj.eq(i).addClass("found"); // add class amy be > obj.eq(i).attr( { > id:"found" // how bout give it an ID ? > > }); > } > } > }); > > On Tue, May 12, 2009 at 3:50 PM, heohni < > > heidi.anselstet...@consultingteam.de> wrote: > > > In my case I used now: > > > var parent_id = $(this).parents("div:first").attr("id"); > > $('#'+parent_id).hide(); > > > var input_id = $('#'+parent_id+">input").attr("id"); > > $('#'+input_id).val(""); > > > To find more than one, I saw some time ago to use find() and each() > > functions. But I can't tell you how they work :-/ > > > Another questions: > > > <div class="ctrlHolder"> > > <label for="vfo"><em>*</em> Verpackungsform</label> > > <select name="vfo"> > > <option value=""></option> > > <option value="6">Neue Eigenschaft</option> > > <option value="4">Oval</option> > > <option value="2">Quadratisch</option> > > <option value="3">Rechteckig</option> > > <option value="1">Rund</option> > > <option value="5">Sonstige</option> > > </select> > > <a href="help.txt?width=200" class="jTip" id="vfo" name="Fehlt > > hier eine Eigenschaft?:"><img src="../img/help.gif" alt="" width="16" > > height="16" border="0"></a> > > <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> > > </div> > > > Within > > $('a.stop').click(function() { > > > How can I access the select name? > > I need to work on the disbaled attribute, but how can I access it? > > > Thanks!! > > > On 12 Mai, 15:40, waseem sabjee <waseemsab...@gmail.com> wrote: > > > yeah it is a tough one. mike got it ! but what happens if you have more > > than > > > one input type ? > > > > On Tue, May 12, 2009 at 3:02 PM, Mean Mike <mcgra...@gmail.com> wrote: > > > > > $('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!!