Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Chosen currently activates on page load, and replaces normal select boxes with Chosen select boxes.
However, I have a custom form with an 'add more' button. When you click on the 'add more' button, it adds another fieldset via AJAX. The problem is, on these AJAX-appened form elements, you won't have Chosen formatting, because Chosen only does the replacement on page load.
Is there a way to trigger Chosen to also replace the select boxes on the AJAX-appended content?
Comments
Comment #1
Dave ReidChosen uses Drupal.behaviors and attach which means it should work out of the box with anything loaded via Drupal core's native AJAX API. Is it not actually working? Which version of the Chosen module and library are you using?
Comment #2
micromegas CreditAttribution: micromegas commentedBack in October, I had to use
in order to get Chosen to work after an AJAX call.
Now, going back and re-testing using the latest versions of the Chosen module and library, it is working correctly.