jQuery get value within child div

后端 未结 8 1680
没有蜡笔的小新
没有蜡笔的小新 2021-02-04 01:50

I need to grab the text value of a child div.

A
B
8条回答
  •  [愿得一人]
    2021-02-04 02:31

    For multiple elements with the same id:

    var text_val = $('#first').children('#second_child').text();
    

    For a single element with a particular id:

    var text_val = $('#second_child').text();
    

提交回复
热议问题