Can I select multiple tags using getElementsByTagName?

后端 未结 4 614
天命终不由人
天命终不由人 2020-12-28 11:28

I\'m using a javascript snippet in order for visitors to my site to increase the font size on all paragraphs using the following javascript:

function increas         


        
4条回答
  •  别那么骄傲
    2020-12-28 12:02

    No, you can't select multiple tags with a single call to getElementsByTagName. You can either do two queries using getElementsByTagName or use querySelectorAll.

    JSFiddle

    var elems = document.querySelectorAll('p,li')
    

提交回复
热议问题