亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長(zhǎng)資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    javascript怎么刪除類

    javascript刪除類的方法:1、通過(guò)“remove("mystyle")”方法為<div>元素移除一個(gè)類;2、通過(guò)“remove("mystyle", "anotherClass", "thirdClass");”方法移除多個(gè)類。

    javascript怎么刪除類

    本文操作環(huán)境:windows7系統(tǒng)、javascript1.8.5版,DELL G3電腦

    javascript怎么刪除類?

    原生JS添加類,刪除類

    為 <div> 元素添加 class:

    document.getElementById("myDIV").classList.add("mystyle");

    為 <div> 元素添加多個(gè)類:

    document.getElementById("myDIV").classList.add("mystyle", "anotherClass", "thirdClass");

    為 <div> 元素移除一個(gè)類:

    document.getElementById("myDIV").classList.remove("mystyle");

    為 <div> 元素移除多個(gè)類:

    document.getElementById("myDIV").classList.remove("mystyle", "anotherClass", "thirdClass");

    檢查是否含有某個(gè)CSS類

    myDiv.classList.contains('myCssClass'); //return true or false

    推薦學(xué)習(xí):《javascript高級(jí)教程》

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)