jQuery Examples - $("a").removeAttr("target")
Description
This would remove target attribute of all the links.
Syntax
Here is the simple syntax to use this method −
selector.removeAttr(attribute)
Parameters
Here is the description of all the parameters used by this method −
attribute This is the CSS property of the matched element.
Example
Following example would remove target attribute of all the links.
Live Demo
<html>
<head>
<title>The jQuery Example</title>
<script type = "text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
</script>
<script type = "text/javascript" language = "javascript">
$(document).ready(function() {
$("a").removeAttr("target");
});
</script>
</head>
<body>
<div>
<a target="_blank" href="http://www.google.com">Google</a> <br/> <br/><a target="_blank" href="http://www.yahoo.com">Yahoo</a>
</div>
</body>
</html>
This will produce following result −
jqueryexamples_attributes.htm
Advertisements