I would like to add a click event listener to the function, but I would like it to happen once. How can i do this?
I would like to stay away from jQuery, if possible, please.
edited
As the answers that I get for this, completely satisfy my need, although I can make it more clear with the context.
I am writing a function to draw a rectangle, first with one click of a button, to initiate the rectangle function. Then, in the drawRectangle function, there are two click event listeners. These are events that I would like to do only once in a function. Allowing the user to create another rectangle if they click the rectangle init button again.
source
share