click event to fire just once
i want the click() event to fire just once. I can use the removeClass() but doesnt sou开发者_运维技巧nds good if i need it again for smthing else.
Any ideas?
You can use .one() to have an event fire just once:
$('#item').one('click', function() {
alert("You'll never see me again!");
});
精彩评论