set the focus in the input field Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › set the focus in the input field This topic has 4 replies, 2 voices, and was last updated 4 years, 8 months ago by ea40. Viewing 5 posts - 1 through 5 (of 5 total) Author Posts September 13, 2021 at 1:29 pm #34695 ea40Participant Hi, I implemented the Searchbox on this page: https://kuechenzentrum-mg.de/test-suche/ On click the magnifier icon the input field is visible. I want to set the focus in the input field after it is visible. The solution on this page https://wordpress.org/support/topic/how-to-auto-focus-users-on-search-field-with-no-click/ doesn´t work for me. Have you a configuration which can help me or have you another solution ? BR Ertan September 13, 2021 at 2:00 pm #34696 Ernest MarcinkoKeymaster Hi! Try this variation of the custom code instead: add_action("wp_footer", "asp_custom_script_wp_footer"); function asp_custom_script_wp_footer() { ?> <script> jQuery(function($){ $('.promagnifier').on('click', function(){ var _this = this; setTimeout(function() { if ( $(_this).closest('.asp_w').attr('asp-compact') == 'open' ) { $(_this).closest('.asp_w').find('input.orig').focus(); } }, 500); }); }); </script> <?php } September 13, 2021 at 2:10 pm #34699 ea40Participant You cannot access this content. September 14, 2021 at 8:30 am #34720 Ernest MarcinkoKeymaster You cannot access this content. September 14, 2021 at 10:42 am #34730 ea40Participant You cannot access this content. Author Posts Viewing 5 posts - 1 through 5 (of 5 total) The topic ‘set the focus in the input field’ is closed to new replies.