I had a Visualforce page where the second field is a date field. Everytime the page loads, salesforce automatically brings the date field in focus and the calendar widget pops up. This can be very confusing to the users as the date field is required to be populated only in certain cases. Is there a way to remove the focus or allow me to have some other field in focus?

Create hidden element inside form

<input id="hiddenElement" type="hidden" />

Add following JS code to add an window.onload event to set the focus to the hidden element

<script type="text/javascript">

window.onload = setFocus

function setFocus() {




To conclude, ..

So no longer the page load will default the focus to Calendar field and no longer the pop-up will hinder the page view.

nJoy Coding!!