James
James

Reputation: 1956

jQuery Chosen Plugin on live

I'm having some trouble finding a way to register a multiselect with the Chosen plugin. I'm dynamically loading a form into the DOM with Ajax, and want one of the selects to make use of the Chosen plugin.

I've tried calling

$('.chosen-element').chosen()

on ajaxComplete, which suggests that I won't be able to generate a custom event and bind to it. I've also tried cloning the returned select and registering the cloned element with the plugin, but to no avail.

Has anyone found a nice way to get Chosen working dynamically?

Upvotes: 0

Views: 378

Answers (1)

Adil
Adil

Reputation: 148120

You do not have closing quote for the selector, you have semi colon ; instead of single quote '

Change

$('.chosen-element;).chosen()

To

$('.chosen-element').chosen()

Upvotes: 1

Related Questions