how can i get the text inside an anchor tag in jquery

前端 未结 2 737
醉话见心
醉话见心 2021-01-13 21:13


//jquery
$(\"#div1 a\").click(function(){
var text = $(         


        
2条回答
  •  醉话见心
    2021-01-13 21:13

    Inside the click handler, this refers to the element which triggered the handler execution :

    $("#div1 a").click(function(){
        var text = $(this).text();
    });
    

提交回复
热议问题