Attributes API
attr.remove()
Removes the passed attributes from the matched DOM elements.
- Accepts arguments as strings and arrays of strings.
You can pass attributes as individual arguments, as an array, or as a string separated by commas or spaces.
Each value is seen as a new argument. - If no arguments are passed, it removes all attributes from the matched DOM elements.
Example:
$('div ?').attr.remove();
// Removes all attributes from all <div> elements.
$('div ?').attr.remove('data-name');
// Removes the attribute 'data-name' from all <div> elements.
$('div ?').attr.remove('data-name', 'class');
// Removes the attributes 'data-name' and 'class' from all <div> elements.
$('body').attr.remove('data-name', 'class');
$('body').attr.remove(['data-name', 'class']);
$('body').attr.remove('data-name, class');
$('body').attr.remove('data-name class');
// Removes the attributes 'data-name' and 'class' from the <body> element.