+ 3
[Solved] Q. Is it possible to make a function run only once.
I have a canvas. A function starts running upon clicking the canvas. I want that the canvas screen is only clickable once. Or making the function not interuppt other functions.
5 Answers
+ 4
Shobhit :)
U can use addEventListener
(Third argument)
HTMLElement. addEventListenter('click', ()=>{
//some function
}, {once:true})
example
https://code.sololearn.com/WlP82QNb0zMH/?ref=app
+ 5
You could remove the click event after the click
+ 4
Thank you so much all of you Lisa A͢J - SÍoÍlÍoÍHÍeÍlÍpÍeÍrÍ Beauty Sancho Godinho â¤đ¤
+ 3
Help For You: https://code.sololearn.com/WE5U7s39bmOe/?ref=app
+ 2
Shobhit :)
There is one() method in jQuery which allow you to click only once.