h5 classList使用

   <div id="box">
      <input type="text" value="添加"> 
      <input type="text" value="删除">
      <input type="text" value="获取">
      <input type="text" value="切换">
      <input type="text" value="">
    </div>

    <script>
        const ipt=document.querySelectorAll("input");
        const box=document.querySelector("#box");
        ipt[0].onclick=function(){
          //js className 覆盖;
          //jq addClass();
          //添加类名 类似jquery
          box.classList.add("1","2");
        };

        ipt[1].onclick=function(){
            //删除类名
           box.classList.remove("1","2")
        };
        ipt[2].onclick=function(){
            //类名的长度
            console.log(box.classList.length)
        }
        ipt[3].onclick=function(){
            //切换类名 没有则添加类名
            box.classList.toggle("1")
        }
        ipt[4].onclick=function(){
            //判断是否存在类名
            console.log(box.classList.contains("1"))
        }
    </script>

 

引用提到了一个关于在iframe页面中使用wx.config和wx.ready的问题。根据该引用中的描述,当在iframe页面中开启了wx.config的debug为true时,内嵌页面无法使用wx.config和wx.ready,并且没有任何alert来显示这个问题。因此,将wx.config放到外层页面可以看到alert,这说明内部无法使用wx.config和wx.ready。基于这个信息,我们可以得出结论,在iframe页面中使用wx.config和wx.ready时会遇到问题。 引用提供了一个文章的链接,该链接可能包含关于h5使用wx.getLocation的相关信息。请点击链接查看详细内容。 总结以上信息,虽然没有直接回答到"h5使用wx.getLocation"的问题,但我们可以得出结论,在iframe页面中使用wx.config和wx.ready会遇到问题。如果你需要了解关于h5使用wx.getLocation的详细信息,建议点击提供的链接进行查看。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [H5页面兼容微信内置功能wx.ready,wx.getLocation在iframe内遇到无法获取位置也不报错问题](https://blog.csdn.net/HA_LLL/article/details/114980269)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [微信小程序使用wx.getLocation获取定位,点击取消后打开手机设置,重新获取定位](https://download.csdn.net/download/zxh7770/76693040)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值