Log in

Search without clicking on form like google | Set focus to search bar [RESOLVED]

When we visit google or any search angine, we dont need to click on search field to type, u can directly start typing on desktop site and press enter to get result. I am using ajax search pro for my site, how to implement this in wordpress site? Please help. I googled it but not found exactly i m looking for.
 

Attachments

RESOLVED THIS

Code:
add_action("wp_footer", "asp_custom_script_wp_footer");
function asp_custom_script_wp_footer() {
    ?>
    <script>
    jQuery(function($){
        setTimeout(function() {$('input.orig').focus();}, 1000);
    });
    </script>
    <?php
}
 
RESOLVED THIS

Code:
add_action("wp_footer", "asp_custom_script_wp_footer");
function asp_custom_script_wp_footer() {
    ?>
    <script>
    jQuery(function($){
        setTimeout(function() {$('input.orig').focus();}, 1000);
    });
    </script>
    <?php
}
So basically this focuses your cursor in the search field on page load?
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar Topics

Latest Products reviews

Top Products

  • Yoast SEO Premium
    Yoast SEO Premium
    Yoast SEO is the most total WordPress SEO module
    • Apanha
    • Updated:
  • BeTheme
    BeTheme
    Betheme is full of different pre-built websites so you can easily import any demo website.
    • Apanha
    • Updated:
  • Wp Rocket
    Wp Rocket
    Wp Rocket - Speed up your WordPress website with WP Rocket caching plugin.
    • Apanha
    • Updated:
  • Elementor Pro
    Elementor Pro
    Elementor Pro is the most advanced page builder for WordPress
    • Apanha
    • Updated:
  • Claue - Clean, Minimal Magento 2 and 1 Theme
    Claue - Clean, Minimal Magento 2 and 1 Theme
    Claue - Clean, Minimal Magento 2 and 1 Theme is an excellent template for a modern eCommerce store
    • Apanha
    • Updated: