This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Input Search Field Won't Focus After Click Magnifying Glass

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Input Search Field Won't Focus After Click Magnifying Glass Reply To: Input Search Field Won't Focus After Click Magnifying Glass

#37589
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Some custom code will be needed for this, as the input focus has to be triggered on that 3rd party magnifier click event. Luckily it should not be too difficult.

Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

add_action('wp_footer', 'asp_footer_custom_script', 999999);
function asp_footer_custom_script() {
	?>
	<script>
	(function($){
		$('header .fa-search').on('click', function(){
			setTimeout(function(){
				$('.dialog-widget-content .asp_m input.orig').get(0).focus(); 
			}, 250);
		});
	})(WPD.dom);
	</script>
	<?php
}