jQuery oneOnly

http://benalman.com/ https://gist.github.com/894952

by Ben Alman

HTML

<script src="https://gist.github.com/raw/894952/3201c8289492d8e9d6cce8bd0fe85adccaeff6f9/jquery.ba-oneonly.js"></script>
<!-- see https://gist.github.com/894952 -->

<input name="a"></input>
<input name="b"></input>
<input name="c"></input>

JavaScript

// This will triggger once for each element AND each event type.
$('input').one('click keydown', function( e ) {
    console.log('one', e.type, this.name);
});

// This will only trigger once, period.
$('input').oneOnly('click keydown', function( e ) {
    console.log('oneOnly', e.type, this.name);
});