开发者

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!");
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜