0

This is my code, and always returns Null in the "if" sentence. The id exists. When I try to do document.getElementById in the console, it runs properly.

<apex:component>
  <script type="text/javascript">
    function refresh() {
      var run = document.getElementById('db_ref_btn');
      if (run == null) {
        alert('Por favor, añade un Informe a la página de Inicio.');
      } else {
        document.getElementById('db_ref_btn').click();
      }
    }
    window.onload = setInterval(refresh);
  </script>
</apex:component>
Rajesh
  • 21,405
  • 5
  • 35
  • 66
Nikilonga
  • 19
  • 10

0 Answers0