jQuery $.each / loop through elements with regex pattern

// Handing to remember for looking through a subset of dom elements..

// The first one loops through to find any dom ID’s STARTING WITH ‘_content’
// (in this case we are hiding the selected elements)

$("div[id^=’_content’]").each(function() {

// Next one selects ID’s that CONTAIN the text ‘_content’, i.e. mydiv_content

$("div[id*=’_content’]").each(function() {

Leave a Reply