how to change onclick event with jquery?

后端 未结 7 1224
梦毁少年i
梦毁少年i 2020-12-08 09:01

I have create a js file in which i am creating the dynamic table and dynamically changing the click event for the calendar but onclicking the calender image for dynamic gene

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 09:38

    You can easily change the onclick event of an element with jQuery without running the new function with:

    $("#id").attr("onclick","new_function_name()");
    

    By writing this line you actually change the onclick attribute of #id.

    You can also use:

    document.getElementById("id").attribute("onclick","new_function_name()");

提交回复
热议问题