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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.