jQuery: get data attribute

后端 未结 5 2281
慢半拍i
慢半拍i 2020-11-27 03:18

In my html I have a span element:

This is a

5条回答
  •  暖寄归人
    2020-11-27 04:21

    This works for me

    $('.someclass').click(function() {
        $varName = $(this).data('fulltext');
        console.log($varName);
    });
    

提交回复
热议问题