Home › Forums › ACF PRO › set the value of the relationship field with jquery › Reply To: set the value of the relationship field with jquery
I have examples of setting fields using jQuery, but I have not done a relationship field. I did do this for a date field recently for another post. This had to do with interacting with the jQuery datepicker itself as apposed to interacting directly with the ACF field. I’m guessing that a relationship field would be similar due to the fact that you’re dealing with a select2 field and would probably need to interact directly with setting the value by calling some select2 function.
Anyway, the example for the datepicker field is here https://support.advancedcustomfields.com/forums/topic/autocomplete-end-date-when-start-date-is-selected-in-jquery-date-picker/
and my other examples are here, they might help. https://github.com/Hube2/acf-dynamic-ajax-select-example
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.