How to simulate a click to make the current input lose its focus with JavaScript
Try using the blur
event. If you're using jQuery there is a method you can call on the DOM object to raise this event. The blur()
method should also work without jQuery.
http://docs.jquery.com/Events/blur
I would imagine using blur()
would do the trick:
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function() {
document.getElementById("input").focus();
document.getElementById("input").blur();
});
</script>