我希望a div切换其类(切换)onclick,然后再次恢复原始类onclick
我的代码是:
function myfunc() {
//the code over here
}Run Code Online (Sandbox Code Playgroud)
.normal {
width:25%;
height:25%;
background: #f00;
}
.active {
width:100%;
height:100%;
background: #f00;
}
#div{}Run Code Online (Sandbox Code Playgroud)
<body>
<div id="div" onclick="myfunc()">click here</div>
</body>Run Code Online (Sandbox Code Playgroud)