How to add a new options to JQuery Chosen Plugin Dynamically

H

How Can We Help?

How to add a new options to JQuery Chosen Plugin Dynamically

If users is the id of the select Chosen dropdown box, then use JQuery to append new options dynamically as in the example below

$("#users").append('<option value="1">User</option>').trigger("chosen:updated");

.trigger(“chosen:updated”);  refreshes the Chosen dropdown box with the new option.

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me