[jQuery] Re: element selection
Probably $('#'+id).remove(). It's an usual string. On Feb 17, 3:56 pm, Ashit Vora wrote: > Hi, > I 've a small query, I have a table with each row having a unique id > (eg. 1,2,3,4) > > As an Ajax response I receive ID in JSON format. > > I want to remove the row having that ID. > > For selecting element using Id, I generally use $('id').fadeOut(); > > but how do I out the value of variable in this ? (resp.id in my case) > > Thanks :)
[jQuery] Re: element selection
you can put additional trribute in table row definition, eg: then you can select this row using standard jquery selection mechanism: $("#{tablename}> TBODY > TR[rid='{your_rid_value}']").fadeout(); tom 2009/2/17 Ashit Vora > > Hi, > I 've a small query, I have a table with each row having a unique id > (eg. 1,2,3,4) > > As an Ajax response I receive ID in JSON format. > > I want to remove the row having that ID. > > For selecting element using Id, I generally use $('id').fadeOut(); > > but how do I out the value of variable in this ? (resp.id in my case) > > Thanks :)
[jQuery] Re: element selection
may be $(resp.id).fadeOut(); :) 2009/2/17 Ashit Vora > > Hi, > I 've a small query, I have a table with each row having a unique id > (eg. 1,2,3,4) > > As an Ajax response I receive ID in JSON format. > > I want to remove the row having that ID. > > For selecting element using Id, I generally use $('id').fadeOut(); > > but how do I out the value of variable in this ? (resp.id in my case) > > Thanks :)
[jQuery] Re: element selection problem
> From: bob > > jQuery('#genderSector div.explanation'); > > did not work. It works for me. I went to http://docs.jquery.com/ and entered this in the multiline Firebug console: $('body').append(' Alabama Alaska Female Male '); jQuery('#genderSector div.explanation') (The $('body')... should all be on one line for the long quoted string.) This logged a single jQuery object with the expected content. There must be something else going on in your test page that isn't apparent from the code snippet. If it doesn't jump out at you, post a link to that test page. > Does not matter what value of i is. I just wanted to show > that it would be used in iteration. I had a feeling that was the case, but when troubleshooting a code snippet out of context, it pays to double-check my assumptions. -Mike
[jQuery] Re: element selection problem
jQuery('#genderSector div.explanation'); did not work. Does not matter what value of i is. I just wanted to show that it would be used in iteration.
[jQuery] Re: element selection problem
Hi Bob, To select all elements with a class="explanation" within the document use: jQuery('.explanation') To select DIV's with a class="explanation" in your markup use: jQuery('div[id$=Sector] .explanation') Regards, Maurício --- De: "bob" Para: "jQuery (English)" What is the best way to select class="explanation"? I have available array var idArray = ['', 'state','gender']; I tried this jQuery('#'+idArray[i]+'Sector div.ex'); and it did not work. Note: I cannot use id inside of Alabama Alaska Female Male
[jQuery] Re: element selection problem
You didn't say what the value of 'i' is. Can I assume that it is an integer value 0, 1, or 2? Also, why div.ex in your selector? I would think you'd want div.explanation to match the class in the HTML. -Mike > From: bob > > What is the best way to select > class="explanation"? > I have available array > var idArray = ['', 'state','gender']; > > I tried this > jQuery('#'+idArray[i]+'Sector div.ex'); > and it did not work. > > Note: I cannot use id inside of > > >maxlength="4"> > > > > > > Alabama > Alaska > > > > > > Female > Male > > >