Add class to first child using javascript

前端 未结 3 1204
臣服心动
臣服心动 2021-01-12 18:04

is there any reason this chain does not work? It does not add the class:

document.getElementsByTagName(\'nav\')[0].firstChild.className = \"current\"
         


        
3条回答
提交回复
热议问题