Elements removeAttr() - KirkGarcia182/domExtend GitHub Wiki

removeAttr()

Description

Removes an attribute from an element or multiple attributes from an element which is separated by a white-space

Syntax

element.removeAttr(attributeNames);

Parameters

attributeNames - A String containing the name or names of the attributes you want to remove, separated by a white-space

Return Value

The element you just manipulated so you can chain these methods.

Example

<!DOCTYPE html>
<html>
<head>
	<title>domExt Examples</title>
</head>
<body>
	<div id="app">
		<div class="menus">
			<ul id='menuList'>
				<li><a>Menu 1</a></li>
				<li><a>Menu 2</a></li>
				<li><a>Menu 3</a></li>
			</ul>
		</div>
	</div>
	<script type="text/javascript" src="domExt.js"></script>
	<script type="text/javascript">
		window.$ = document;

		let app = $.byId('app');
		app.attr({
			title: 'domExt is the best!',
			style: 'color: lime',
			class: 'class1'
		});

		app.removeAttr('title style class');
		console.log(app);
		/* Result 
			<div id='app'>...</div>
		*/
	</script>
</body>
</html>
⚠️ **GitHub.com Fallback** ⚠️