How to get anchor text/href on click using jQuery?

前端 未结 5 1592
攒了一身酷
攒了一身酷 2020-11-29 20:25

Consider I have an anchor which looks like this

 
      
5条回答
  •  生来不讨喜
    2020-11-29 20:42

    Edited to reflect update to question

    $(document).ready(function() {
        $(".res a").click(function() {
            alert($(this).attr("href"));
        });
    });
    

提交回复
热议问题