Reputation: 9391
I need to remove all attributes (ids, classes, events, styles etc.) from every element inside a <div>
.
How can I achieve this with jQuery?
Upvotes: 2
Views: 4055
Reputation: 495
This is possible using a simple while loop:
$("div#myDiv").children().each(function() {
while(this.attributes.length > 0)
this.removeAttribute(this.attributes[0].name);
});
Where 'myDiv' is the ID of the parent div.
Upvotes: 3