[jQuery] Re: find ID of input within a div

2009-05-12 Thread Mean Mike
so what your saying is you may have more the one input in the same div and you want the id of every input in said div ? what format do you want them in if you have multiple inputs your gonna have multiple results.. here is where I'm going with this what if you looped through the div like this $

[jQuery] Re: find ID of input within a div

2009-05-12 Thread heohni
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 c

[jQuery] Re: find ID of input within a div

2009-05-12 Thread waseem sabjee
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 bou

[jQuery] Re: find ID of input within a div

2009-05-12 Thread heohni
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 wor

[jQuery] Re: find ID of input within a div

2009-05-12 Thread waseem sabjee
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 wrote: > > $('a.stop').click(function() { >var input_id = $(this).prev().attr("id"); > var parent_id = $(this).parents("div:first").attr("id")

[jQuery] Re: find ID of input within a div

2009-05-12 Thread Mean Mike
$('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 wrote: > hi! > > I have this construct: > class="textInput"> > > On click I want to hi