JQuery get content of span

后端 未结 6 1670
萌比男神i
萌比男神i 2021-02-19 00:29

I\'m trying to get the content of a span when a button is clicked. This is the html:

6条回答
  •  清歌不尽
    2021-02-19 00:50

    The span isn't a parent of the '.select-location' button, but the div is (which the span is in). Using your markup, try something like this:

    var spanVal = $(this).parent('.multiple-result').find('span').html();
    

提交回复
热议问题