focus blur activeElement - log example
by ian_smithz
HTML
<input type="text" id="a"/>
<input type="text" id="b"/>
<input type="text" id="c"/>
<br />
<textarea></textarea>
CSS
textarea { width: 80%; height: 20em; }
JavaScript
function log(what, id) {
$('textarea').val($('textarea').val() + '\n' + what + ' - ' + id + document.activeElement);
}
$('input').on('blur', function() {
log('blur', this.id);
}).on('focus', function() {
log('focus', this.id);
})