jQuery can create event handlers that execute exactly once. How is this done?
$('button').one('click', function() { console.log('this will only happen once'); }); Source: .one() | jQuery API Documentation
$('button').one('click', function() { console.log('this will only happen once'); });
$('button').once('click', function() { console.log('this will only happen once'); });
$('button').on('click', function() { console.log('this will only happen once'); }).off('click');
$('button').click(function() { console.log('this will only happen once'); }, false);