jQuery: How to get the value of an html attribute?

前端 未结 6 967
一生所求
一生所求 2020-11-30 13:01

I\'ve got an html anchor element:

Link Text

...and I want to get the contents of the title so

6条回答
  •  独厮守ぢ
    2020-11-30 13:40

    $('a').click(function() {
        var title = $(this).attr('title');
        alert(title);
    });
    

提交回复
热议问题