undefinedfix
Sign in

Onclick binding click event does not trigger

Mbotet edited in Fri, 26 Aug 2022

Bind an onclick event to an element on the dom. The event method is click. Why can't the click event be triggered?

clipboard.png

4 Replies
Innuendo
commented on Fri, 26 Aug 2022

Click is similar to the keyword and reserved word in JS, so it is not recommended to use it

erqes
commented on Sat, 27 Aug 2022

Change the function name, it may be keyword conflict

Titirca
commented on Sat, 27 Aug 2022

Change the name of the click method

AIdrick
commented on Sat, 27 Aug 2022

< button onclick = "click" > < / button >, onclick assigns the function name, not the result of the function.

lock This question has been locked and the reply function has been disabled.