我如果想添加一个div class为为任意一层 怎么添加!用JS

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div class="one">
        <div class="two">
            <div class="three">
                <div class="four"></div>
            </div>
        </div>
    </div>
</body>

</html>


19990000
浏览 1340回答 1
1回答

我爱钱端

var one = document.getElementsByClassName('one')[0];one.className = "one find";
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript