Get text from anchor tag

后端 未结 2 1226
死守一世寂寞
死守一世寂寞 2020-12-24 05:51

I have the following anchor tag

Google

I know how to get the href from an anchor take:

2条回答
  •  感动是毒
    2020-12-24 06:04

    On using the .text() as mentioned, I got the text of all the anchor tags combined in my code:

    HTML:

     
    

    JS:

    $("#listGroupUserRaces").click(function () {
       alert($(this).text());
    });
    

    OUTPUT:

    • First item
    • Second item
    • Third item

提交回复
热议问题