Visualforce Page: How to remove focus / selection from first input field

4:22 PM

Just took this solution from the above mentioned posts, summarizing below


When a Visualforce Page loads, the date input field is selected by default. The usual behavior is that the first input field or box in the page is focussed by default. Clearly annoying in this case


Add the below piece of code in your visualforce page.

function setFocusOnLoad() {}


Tried the other option suggested, but it does NOT work for me.
<script>beenfocused = true; </script>


  1. great tip. I had many widgets on my dashboard and every widget contained first field as date field. So onload my page was cluttered with date pickers. sigh. When is salesforce gonna make developers' lives easy?