I want to bind the Jquery plugin Chosen on a select box that I create via Xajax, the Select does not figure in the DOM when the page is loaded.
So I start by returning the select box and then I execute .chosen() on the box ID:
<? $objResponse = new xajaxResponse();
$objResponse->assign($selectID, 'innerHTML', $codeThatCreatesSelectBox);
$objResponse->script('$(function(){ $("#selectID").chosen(); });');
return $objResponse; ?>
But I'm obviously doing something wrong... How could I do this ?
EDIT
I tried waiting for ajax returns before firing the plugin by using ajaxComplete() :
$objResponse->script('$("#selectID").ajaxComplete(function() {$("#selectID").chosen(); });');
But it doesn't change anything..