This example describes the use of the Removeattr () method in jquery. Share to everyone for your reference. The specific analysis is as follows:
This method removes the corresponding attribute from the matching element.
Syntax structure:
Copy Code code as follows:
$ (selector). Removeattr (attribute)
Parameter list:
Parameters |
Describe |
Attribute |
Define the attributes to remove from the matching element |
Instance code:
Copy Code code as follows:
<! DOCTYPE html>
<meta charset= "Utf-8" >
<meta name= "Author" content= "http://www.jb51.net/"/>
<title> Cloud-dwelling community </title>
<style type= "Text/css" >
div{
height:200px;
width:200px;
BORDER:1PX Solid Blue
}
. reset{
font-size:20px;
Color:green;
}
</style>
<script type= "Text/javascript" src= "Mytest/jquery/jquery-1.8.3.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#btn"). Click (function () {
$ ("div"). Removeattr ("class");
})
})
</script>
<body>
<div class= "Reset" > Cloud-dwelling community welcome you </div>
<button id= "BTN" > Click to view Effect </button>
</body>
In the above code, click the button to remove the Remove class attribute.
I hope this article will help you with your jquery programming.