On 14/03/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!
This should work: $('table.grouped tr.group').click(function() { var attrName = $(this).attr("grp"); $(this).siblings("[EMAIL PROTECTED]" + attrName + "]").toggle(); }) return false is only needed if you are clicking on an <a> _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/