• Again thanks for a great plugin…

    One last thing – would it be possible to add an option for the HTML input autofocus Attribute?

    I’m creating an index where searching is the only option – making the search field “autofocused” would be great.

    Best regards
    Bjarne

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Great idea, I will definitely consider adding it to the next release.

    Until then you can try to place this code to the functions.php file in your active theme directory. This appends a script that tries to focus the input field upon page load:

    add_action( 'wp_footer', 'asl_focus_on_load');
     
    function asl_focus_on_load() {
      ?>
      <script>
      jQuery( window ).load(function() {
        jQuery('input.orig').focus();
      });
      </script>
      <?php
    }
    • This reply was modified 7 years, 9 months ago by wpdreams.
    Thread Starter Bjarne Oldrup

    (@oldrup)

    Yup – that works. A built in option would still be great though ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Autofocus on page load?’ is closed to new replies.