Thank you - this will be a huge help to me moving forward. This solution works and more importantly I understand it so I can build off it. This is my first mailing list and so far, I dig ;->
-- TB Matt Stith wrote: > > yeah, same idea, just use a period instead of a # > > On 1/26/07, chango <[EMAIL PROTECTED]> wrote: >> >> Hi, i use this for ID atributte all the time, i hope it help for your >> case: >> >> function toggle(className) { >> $('#'+className).toggle(); // this doesn't work obviously >> } >> >> ToddB23 wrote: >> > >> > Guessing this is a fundamental, and I have read the docs but... >> > >> > Can I pass a variable to JQuery to use as a class name? >> > >> > ie - >> > >> > function toggle(className) { >> > $(className).toggle(); // this doesn't work obviously >> > } >> > >> > Since the class name has to be in quotes I'm confused as to how to put >> > anything but an actual string into JQuery - ($('.className').toggle();. >> > >> > If it help to explain, I ended up working around it by making an array >> > from the getElementsByName and passing that array to JQuery: >> > >> > function toggleTree(e,conversation_num) { >> > $(e).toggleClass('expanded'); >> > var alerts_row_name = "alerts_" + conversation_num; >> > var alerts_rows = document.getElementsByName(alerts_row_name); >> > $(alerts_rows).toggle(); >> > } >> > >> > Thanks, TB >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Passing-a-variable-as-a-class-name-to-%24%28i-want-a-variable-here%29.hide%28%29-tf3077753.html#a8662582 >> Sent from the JQuery mailing list archive at Nabble.com. >> >> >> _______________________________________________ >> jQuery mailing list >> discuss@jquery.com >> http://jquery.com/discuss/ >> > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Passing-a-variable-as-a-class-name-to-%24%28i-want-a-variable-here%29.hide%28%29-tf3077753.html#a8663129 Sent from the JQuery mailing list archive at Nabble.com. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/