Working with auto-generated html code, with variable classnames: table-col-44, table-col-19, table-col-121
etc.
I've got a loop that's going through and selecting these variable classes using this jQuery selector functionality:
for(r in replace){
var targ = replace[r];
$("[class^='"+targ+"']").each(function(){
...
})
}
The problem is, once I've selected the classes I want to scrub, I can't find a way to target them to remove them. Often these are <p>
and <td>
tags that have other classes that need to be preserved, so I can't just wipe the class attribute altogether. Is there a way to pass the matched class as an argument to the each() function? Or perhaps there's some kind of $(this).removeClass([selected])
keyword that comes with jQuery? Totally stumped here. Thanks for the help!