您当前的位置: 首页 >  html

html标签设置自定义属性、setAttribute、getAttribute

发布时间:2021-06-25 22:23:14 ,浏览量:4

目录

  • 第一种方法
  • 第二种方法

第一种方法

// 设置 btnList[i].myIndex = i; // 获取 this.myIndex; 

第二种方法

// 设置 btnList[i].setAttribute('data-index', i); // 获取 this.getAttribute('data-index'); 
关注
打赏
查看更多评论

暂无认证

  • 4浏览

    0关注

    115983博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录