Get a Div Value in JQuery

后端 未结 7 1996
无人共我
无人共我 2020-12-13 09:26

I have a page containing the following div element:

Some Value

How woul

7条回答
  •  無奈伤痛
    2020-12-13 09:37

    $('#myDiv').text()
    

    Although you'd be better off doing something like:

    var txt = $('#myDiv p').text();
    alert(txt);
    
    

    Some Text

    Make sure you're linking to your jQuery file too :)

提交回复
热议问题