Wednesday 15 January 2014

JQuery Chosen plugin + AJAX loading dynamic select -


I'm using the jQuery plugin I'm trying to fix on this (document). Already, but I have a button that, when clicked, uses azax to dynamically create more select objects that I want to use the "selected" feature. However, only after adding new selection element this new element works correctly and does not do the other: if I have a selection and recently a new selection has been added to Javascript (by clicking on the selection etc.) Drop down) only works for the previous one click (function () {warning ("hello"); var drop = document.getElementById (here) 'select_chzn'); Var spans = drop.getElementsByTagName ('span') [0]; Var selected = spans.innerHTML; $ .post ('$ {pageContext.request.contextPath} / getfield', {'fieldName': selected}, function (result) {document.getElementById ('content'). WinnerHTML + = result;}); SetTimeout (doChosen, 100); Event.preventDefault ();}); }); Function doChosen () {$ (".czn-select"). Chosen (); }

I appreciate any help

if If you want to dynamically select the selected plugin, you can trigger only one lizat update, then you can change it. Say the example is MyDropDown dropdown ID, then

  $ ('# MyDropDown'). Val ('value you want'). Trigger ("liszt: updated"). Trigger ("change");   

Works for me

No comments:

Post a Comment