t0s
t0s

Reputation: 1221

click event to fire just once

i want the click() event to fire just once. I can use the removeClass() but doesnt sounds good if i need it again for smthing else.

Any ideas?

Upvotes: 2

Views: 900

Answers (1)

Tatu Ulmanen
Tatu Ulmanen

Reputation: 124888

You can use .one() to have an event fire just once:

$('#item').one('click', function() {
    alert("You'll never see me again!");
});

Upvotes: 13

Related Questions