如何用JavaScript刪除指定class?
如何用JavaScript刪除指定class?
青春有我
2018-08-05 04:04:19
TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超4個(gè)贊
<div class="abc">點(diǎn)我刪除</div> <script> window.onload=function(){ var abc=document.getElementsByClassName("abc")[0]; abc.onclick=function(){ this.parentNode.removeChild(this); } } </script>
舉報(bào)