Home › Forums › ACF PRO › trigger event on field losing focus › Reply To: trigger event on field losing focus
Hi @marathra
You should be able to do it by using the jQuery focusout() method and acf/input/admin_footer hook to add the script. It should be something like this:
function my_acf_script_focusout() {
?>
<script type="text/javascript">
(function($){
$(document).ready(function(){
$(".acf-field-1234567890abc input").focusout(function(){
alert( $(this).val() );
})
});
})(jQuery);
</script>
<?php
}
add_action('acf/input/admin_footer', 'my_acf_script_focusout');
Where ‘acf-field-1234567890abc’ is based on the field key of your email custom field.
I hope this helps 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.