博客列表 >event.stopPropagation

event.stopPropagation

子龙的博客搬家啦httpswwwcnblogscomZiLongZiLong
子龙的博客搬家啦httpswwwcnblogscomZiLongZiLong原创
2017年08月14日 10:22:36499浏览
先记录一下坑:
    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;
            }

          })
        }


声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议