find a class name that maches a pattern code example
Example: find a class name that maches a pattern
var listClasses = function( pattern ){
var allClassesTmp = {}, allClasses = [];
var rx = pattern ? (new RegExp(pattern)) : (new RegExp(".*"));
$('*[class]').each( function(){
var cn = this.className.split(/\s+/);
for(var i=cn.length;--i>-1;){
if(rx.test(cn[i]))allClassesTmp[ cn[i] ] = 1
}
});
for(var i in allClassesTmp)allClasses.push(i);
return allClasses;
}