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 – 2.0

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

#54496
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

The script still works, the focus is removed by something else. I see a lot of minifed scripts and some errors in the console so it’s probably related to that. The proper solution would be to find out which one is triggered during the pop-up open and remove the incorrect handle that causes the issue.

I can suggest a different method, but there is no guarantee it will work whatsoever:

add_action('wp_footer', function () {
	?>
	<script>
	jQuery(document).on('elementor/popup/show', ()=>{
		setTimeout(()=>{
			let input = jQuery('.dialog-widget .asp_m input.orig').get(0);
			input.focus();
			input.setSelectionRange(0, 9999);
		}, 800);
	});
	</script>
	<?php
}, 999999);

This should delay the focus by a bit, so could potentially override the incorrect blur.