我正在學習javascript和jquery。我最近發現了DOM遍歷。但是當我爲它編寫代碼時,它只是沒有響應。 的代碼是:我的JavaScript不適用於dom遍歷
<!DOCTYPE html>
<head>
<title>Test</title>
</head>
<body>
<script>
$('div').onclick = function pi() {
var p = document.getElementsByClassName('.p');
p.value("hello guys");
};
</script>
<div style="background-color:blue; height:1000px; width:100%px;">
</div>
<div style="height: 600px; background-color: aqua;width: auto;">
<p style="color:black; font-size: 40px;" class="p">d
</p>
</div>
</body>
</html>
取出點,'document.getElementsByClassName( 'P ')'應該是'document.getElementsByClassName(' P')' –
孤單......錯得太多了...... –
錯誤的數量太高了,我甚至都不知道。 – Dellirium