添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I need be able to execute a function on change event in a select2 field.
This is populated based in taxonomy, as taxonomies doens’t wokr as conditional logic field, i need be able to hide or display a text field based on select2 value.

But, i’m not able to do it, because i can’t find the selector, or bind the change event to this.

Can someone help me please?

Note: I’m populating the form in front-end with ajax, everything works fine, but this point is driving me crazy.

Thanks

@James – THANK YOU! I wrestled with this issue for hours, until I finally found your post.

I used to have an ACF select2 event that worked prior to ACF 5.4+:

$("#acf-field_1234567890").on("change", function() { }

In your answer you mentioned that the selector is actually #acf-field_1234567890-input . That solved it for me. I guess at some point ACF changed the select2 wrapper or version? At any rate, thank you! Your code above solved it for me.

Welcome

Welcome to the Advanced Custom Fields community forum.

Browse through ideas, snippets of code, questions and answers between fellow ACF users

Open a new forum thread

Forums

Helping Others

Helping others is a great way to earn karma, gain badges and help ACF development!

  • Help solve topics
  • 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.

    Got it