How to attach an event handler only once?
jQuery offers various event methods for assigning specific event listeners . Normally, jQuery methods will occur as many times as the trigger event is triggered, but when you use jQuery .one() method , the code that attached to only gets executed once per page load.
The jQuery one() method adds event handlers to the selected element. The handler is executed at most once per element per event type.