JQuery get content of span

后端 未结 6 1671
萌比男神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:54

    Here is a Jsfiddler demo using jQuery next

    http://jsfiddle.net/vVK54/1/

    $('button.select-location').live('click', function(event){      
      // set the span value
      var span_val = $(this).next().html();
      alert('selecting...' + span_val);
    });
    

提交回复
热议问题