先记录一下坑:
var btn = test.getElementsByTagName('label');
btn[0].active = 'active';
for(var i = 0; i < btn.length; i++){
btn[i].addEventListener('click',function(e){
var ev = e || window.event;
ev.stopPropagation();
console.log(this)
if(!this.active){
this.className ='btn btn-default mt10 active';
this.active = 'active';
}else{
this.className = 'btn btn-default mt10';
this.active = 0;
}
})
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号