I have a page block table :

<apex:pageBlock id="adressInput" mode="maindetail">
    <div class="panel panel-default">
        <div class="panel-body">
            <div class="form-group">
                <apex:outputLabel for="street" styleClass="control-label col-md-2">
                <div class="col-md-4">
                    <apex:inputText id="street" value="{!searchParameters.street}" styleClass="form-control" html-placeholder="Street..." onkeypress="if (event.keyCode == 13) { searchAddress(); return false; }" />

By default, the focus is set to the first available inputField. In my case, the first input is a text field(street). Every time I go to the page, the focus is set to that field.

How to remove that autofocus?

1 Answer 1


Give this Code in your VF Page. It will remove the autofocus for all the fields and will put the focus on any field that you want

    window.onload = function() {
        //For putting the Focus on particular field

Hope this might helps...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.