Getting data-* attribute for onclick event for an html element

前端 未结 7 1166
一个人的身影
一个人的身影 2020-12-22 23:33

       Click to do something

I wan

相关标签:
7条回答
  • 2020-12-23 00:21

    I simply use this jQuery trick:

    $("a:focus").attr('data-id');
    

    It gets the focused a element and gets the data-id attribute from it.

    0 讨论(0)
提交回复
热议问题