How to get numbers from the Paragraph tag?

前端 未结 2 1918
一生所求
一生所求 2021-01-25 00:02

I am having some values in my paragraph tag. I am trying to get the values from the paragraph tag. But I am unable to get the values. For example,

HTML Code:

<         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-25 00:32

    As a string :

     var str = $('#value').text()
    

    As a number :

     var nb = parseInt($('#value').text().trim(), 10);
    

提交回复
热议问题