Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Cursor Gets Lost after Magnifying Glass › Reply To: Cursor Gets Lost after Magnifying Glass
January 8, 2019 at 10:31 am
#20668
Keymaster
Hi!
The most likely cause is a 3rd party script, but it is usually very hard to determine which one exactly. I think the best solution in this case is to use a custom code to re-focus the input field once the results are finished displaying.
Add this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_action('wp_footer', 'asp_refocus_input', 10);
function asp_refocus_input() {
?>
<script>
jQuery(function($){
$('.asp_m').on('asp_results_show', function(e, id, instance){
setTimeout(function(){
$('.asp_m_' + id + '_' + instance + ' input.orig').get(0).focus();
}, 200);
});
});
</script>
<?php
}
This should resolve the issue, by forcing the input focus.