user276289 user276289 - 1 year ago 110
Javascript Question

jQuery event is triggered twice

I have the following problem with this code:

<button id="delete">Remove items</button>

icons: {
primary: 'ui-icon-trash'
}).click(function() {

If I click this button, the alert show up two times. It's not only with this specific button but with every single button I create.

What am I doing wrong?

Answer Source

Your current code works, you can try it here:

You have something outside the example triggering another .click(), check for other handlers that are also triggering a click event on that element.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download