Get paragraph text inside an element

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

I want to have the text value from a

inside a

  • element.

    html:

  • 9条回答
    •  灰色年华
      2021-02-03 20:12

      Try this:

    • function myfunction(li) { var TextInsideLi = li.getElementsByTagName('p')[0].innerHTML; }
    • Live demo

    提交回复
    热议问题