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
April 20, 2022 at 4:08 pm
#37589
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
}