Select all items where id contains a string

Select all items where id contains a string


Hey All,
The functionality I'm trying to accomplish is a show/hide of all items in a particular group.
so I'm trying to toggle all the items where the element id contains a certain string. i.e "Lamps" or "Switches"
 
The string is used in several id's. ie <tr id="HeaderRowLamps"> and <img src="toggle" id="toggleLamps"/>
 
The id string itself is dynamically generated in the XSLT, ie. <tr id="HeaderRow{CategoryName}"> etc.
 
I thought maybe using the Attribute Contains Selector would work but I'm having some trouble with it...
  $(".triggerExpColCat").click(function(){
     var myID = $(this).attr('id');
     var toggleGroup =  myID.substring(6);   
       if($(MyTriggerID).hasClass("active")) {     
            $("[id*=toggleGroup]").css('display', 'none');    
            $(MyTriggerID).text('Expand all item details.');
        } else {  
            $("[id*=toggleGroup]").css('display', 'block');
            $(MyTriggerID).text('Collapse all item details.');
        }
      $(MyTriggerID).toggleClass("active");
  });










 
What am I doing wrong?