Trigger event methods
Looking into triggering events without jQuery. Turns out you can just use some events as methods, for example .click()
or .blur()
. I’d love to find a listing reference for these methods, but haven’t found one yet.
I’m using .blur()
to dismiss the iOS keyboard once a text input has been focused.
var input = document.getElementById('input'),
button = document.getElementById('button'),
onClick = function(){
input.blur();
};
button.addEventListener( 'click', onClick, false);