HTML Onclick with $(this)

后端 未结 1 345
时光取名叫无心
时光取名叫无心 2021-01-27 05:49

I have a conflict with calling the general jQuery click function and so I need to call an onclick event on the HTML element itself while still being able to use $(this)

相关标签:
1条回答
  • 2021-01-27 06:06

    you can pass this element as parameter:

    onclick="thisFunction($(this));"
    

    and on function recieve it as element:

    function thisFunction(element)
    {
      $this = element;
      //use it here
    }
    
    0 讨论(0)
提交回复
热议问题