What is the best way to remove all classes and all identifiers from all div, ul, li, span, a inside a div with id = "remove"?
Alternative to other answers using find.
$('#remove').find('div, ul, li, span, a').removeAttr('id').removeAttr('class');
Here you
var context = $("div#remove"); $("div, ul, li, span, a", context).removeAttr("class").removeAttr("id");
Try:
$("div, ul, li, span, a","#remove").removeClass()
I wrote you a demo, you can check it from there.
http://jsfiddle.net/TxcAB/1/
$("#remove").click(function(){ $("div,ul,li,a").each(function(){ $(this).removeAttr("id"); $(this).removeAttr("class"); }) })