Get paragraph text inside an element

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

I want to have the text value from a

inside a

  • element.

    html:

  • 9条回答
    •  -上瘾入骨i
      2021-02-03 20:15

      change your html to the following:

      • This Text

      then you can get the content of your paragraph with the following function:

      function getContent() {
          return document.getElementById("myParagraph").innerHTML;
      }
      

    提交回复
    热议问题