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
December 28, 2023 at 9:56 am
#46459
Keymaster
Hi Dan,
I see an error in the console, maybe it is related, but instead of the current code, try this:
add_action('wp_footer', 'asp_footer_custom_script', 999999);
function asp_footer_custom_script() {
?>
<script>
jQuery(function($){
$('header .fa-search').on('click touchstart', function(){
setTimeout(function(){
let input = $('.dialog-widget-content .asp_m input.orig').get(0);
input.focus();
input.setSelectionRange(0, 9999);
}, 250);
});
});
</script>
<?php
}