Q:

Prevent on('click') from being called twice

function foo() {
  bar.on('click', function (evt) {
    console.log("click");
  }
}

If foo is called multiple times, the click handler is added multiple times resulting in the wrong behavior. 
How do you stop this? 

A:

You can use .one() to only call once:

Attach a handler to an event for the elements.  The handler is executed
  at most once per element per event type. 

function foo() {
  bar.one('click', function (evt) {
    console.log("click");
  }
}

JQuery - .one()

