Home › Forums › Backend Issues (wp-admin) › List of JS hooks › Reply To: List of JS hooks
Looks like there’s been an update because now you can just do this. I took this from their API documentation page. You can change the selectors in this to do whatever you want, the code below will fire two events, one for all inputs on change the other specifically for text input types.
var instance = new acf.Model({
events: {
'change': 'onChange',
'change input[type="text"]': 'onChangeText',
},
onChange: function(e, $el){
e.preventDefault();
var val = $el.val();
// do something
},
onChangeText: function(e, $el){
// do something for just text inputs and then call the normal change callback
this.onChange(e, $el);
}
});
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.