Programmatically blur an input textfield


I have an input textfield which is in focus with the keyboard visible. I want to fire a blur event to the textfield programmatically in order to hide the keyboard.

If I give an id to the textfield, do a getElementID and call its blur() function, nothing happens.

document.getElementById("input").blur();  //this didnt work :(

Is there any way I can make the textfield lose focus programmatically so that the keyboard also hides?
I am not using cordova for packaging.

Thanks in advance!