function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nicolás KacowiczNicolás Kacowicz 

Help Text Image disabled if window.onload = setFocus

Hello, If I put:
 
<script type="text/javascript">
            window.onload = setFocus
            function setFocus() {
                if({!reloadDown}) {
                    document.getElementById('{!$Component.buttons.sabr}').scrollIntoView();
                }
            }
</script>
The image of the help text is disabled, if I hover the mouse over it, it does nothing.

But if I delete  
window.onload = setFocus

It works.

Any idea why?
And will it affect my code if I delete this image?
I'm using this function because I have a radio button that if the answer is yes it will show more radio buttons, and they are down the page so I don't want the page to be reloaded to the top so I set focus to a button that is on the bottom.​
Raj VakatiRaj Vakati
Can you share the complete code ?
Nicolás KacowiczNicolás Kacowicz
It is too long. I can write what I use:
 
<apex:page showHeader="true" lightningStylesheets="false" controller="myController" docType="html-5.0" applyBodyTag="false">     
<html lang="en-us" dir="ltr">
<apex:form >
<apex:composition template="SiteTemplate"/> <apex:define name="body"/>
<apex:pageBlock mode="edit" id="pg">
<apex:pageMessages />

Then I have a boolean call reloadDown on my Controller that is set to false in the constructor and turned into true if a Radio Button is selected to 'Yes' or 'No'
This call on my Visualforce page:
<apex:actionSupport event="onchange" action="{!myFunction}"/>

That function set the boolean to true.