Get paragraph text inside an element

后端 未结 9 510
孤独总比滥情好
孤独总比滥情好 2021-02-03 19:21

I want to have the text value from a

inside a

  • element.

    html:

  • 9条回答
    •  北海茫月
      2021-02-03 20:05

      
      
      
          
          Where to JavaScript
          
          
      
      
          

      Welcome to JavaScript!

      Here, we can get the text content of h4 by using:

      document.getElementById('content').textContent
      

    提交回复
    热议问题