Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Clear the searchfield content automatically › Reply To: Clear the searchfield content automatically
November 4, 2025 at 8:44 pm
#55951
Keymaster
Hi!
While there is no option for that, but it is possible via a small custom coded snippet:
add_action(
'wp_footer',
function () {
?>
<script>
jQuery(function($){
$('.asp_m input.orig').on('blur', function(){
$(this).closest('.asp_m').find('input').val('');
});
});
</script>
<?php
}
);
Add this code via the Code Snippets plugin (or similar) or 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.