Get paragraph text inside an element

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

I want to have the text value from a

inside a

  • element.

    html:

  • 9条回答
    •  执笔经年
      2021-02-03 20:12

      HTML:

      • This Text

      JavaScript:

      function myfunction(foo) {
          var elem = foo.getElementsByTagName('p');
          var TextInsideLi = elem[0].innerHTML;
      }​
      

    提交回复
    热议问题