JSFiddle - React, Tailwind, and code Playground
by davestein
HTML
Type something in first field and then hit enter in a Webkit browser
<div id="field-container">
<input type="text" id="field1" />
<input type="text" id="field2" />
</div>
JavaScript
$('#field-container').delegate( 'input', 'blur', function( e ) {
$('body').append('blurred<br />');
removeInput( this );
});
$('#field-container').delegate( 'input', 'keydown', function( e ) {
var input = this;
setTimeout( function() {
if ( e.keyCode === $.ui.keyCode.ENTER ) {
$('body').append('enter hit<br />');
removeInput( input );
}
}, 1 );
});
var removeInput = function( input ) {
$(input).remove();
};