There's no need to use "eval" in this case. The selector is a string, you can just "+" it all together.
Karl Rudd On 3/15/07, Graham Churchley <[EMAIL PROTECTED]> wrote: > > I want to hide the all table rows that have a specific value for the custom > 'grp' attibute. > This code works: > > $('table.grouped tr.group').click(function() { > > var attrName = $(this).attr("grp"); > > eval("$(this).siblings('[EMAIL PROTECTED]" + attrName + "]').toggle()"); > > return false; > > }) > > Basically, I get the 'grp' property value of the row that is clicked. > Then I toggle all siblings that have the same value for the grp attribute. > > Question: Is there a way to do this without using the eval method? > > More information: > I have an html table and I'm grouping the rows based on a column sort. > The result is a bunch of tr elements with the same 'grp' attribute value > followed by another bunch of tr elements with the same 'grp' attribute value > thus: > <tr grp="myAttr1">... > <tr grp="myAttr1">... > <tr grp="myAttr1">... > > <tr grp="myAttr2">... > <tr grp="myAttr2">... > <tr grp="myAttr2">... > etc. > > Thanks! > > _________________________________________________________________ > Find a local pizza place, movie theater, and moreā¦.then map the best route! > http://maps.live.com/?icid=hmtag1&FORM=MGAC01 > > > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/