getElementsByClassName Help (Uncaught reference error when assigning to variable)

前端 未结 3 1323
说谎
说谎 2021-01-22 06:16

Having some trouble selecting class names with plain \'ol vanilla javascript:

var email = document.getElementsByClassName(\'email\');
var phone = document.getEle         


        
3条回答
  •  渐次进展
    2021-01-22 07:03

    document.getElementsByClassName returns a nodeList. You would access it similarly to an array of elements.

    Edit:

    changed to nodeList

提交回复
热议问题