Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › search input issue
This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko 4 years, 9 months ago.
- AuthorPosts
- February 12, 2019 at 1:18 pm #21078
Hi,
in the menu there is currently a magnifying glass as icon, if you click on it, the input field opens. But in order to enter something into the search field, I have to click into the input field and then I can write.
However, I want the input field to open after clicking on the icon and I can write directly into the input field without clicking again.
Is there a way to do this?
Best regardsFebruary 12, 2019 at 1:30 pm #21079Hi,
I believe the only option there is to use a custom code, since the plugin is integrated into a custom container.
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!add_action('wp_footer', 'asp_focus_on_menu_click'); function asp_focus_on_menu_click() { ?> <script> jQuery(function($){ $('li.fusion-main-menu-search a').on('click', function(){ $('.fusion-custom-menu-item-contents .asp_m input.orig').get(0).focus(); }); }); </script> <?php }
This should force the input focus, once the magnifier icon is clicked.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 19, 2019 at 12:31 pm #21160You cannot access this content.February 19, 2019 at 2:27 pm #21170You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 26, 2019 at 2:10 pm #21285You cannot access this content.February 26, 2019 at 3:13 pm #21290Hi,
Thank you! For some reason it only works if I add some delay to the focus script. The final code is then:
add_action('wp_footer', 'asp_focus_on_menu_click'); function asp_focus_on_menu_click() { ?> <script> jQuery(function($){ $('li.fusion-main-menu-search').on('mouseup touchend', function(){ setTimeout(function() { jQuery('.fusion-custom-menu-item-contents .asp_m input.orig').get(0).focus();}, 240); }); }); </script> <?php }
Once you clear your site and browser cache, it should start working.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.