Is it possible to add jQuery UI theme (Combobox, button) to dynamic elements -
ex: dynamic select box or button (from ajax response) when inserted page should render in jquery ui combobox style or jquery ui button style.
$.get("someurl", function(html){ $("p").append(html); // @ point selectbox & button should rendered // jquery ui combobox & jquery ui button }
edited
response html contains form list of textfield, selectbox & button
<select name="scope" > <option value="in">in</option> <option value="out">out</option> </select> <div class="buttoncontainer"> <button name="save">save</button> <button name="cancel">cancel</button> </div>
after html appended want style select box using $("select").combobox(). in main page (js file) have added below line in document ready method.
$("select").combobox() $("button").button()
like jquery has .on() attach event handler function dynamic elements. in same way possible add ui theme (combobox, button) dynamic elements ?
updated:
i guess triggering event when ever page html loaded (by ajax). http://jsfiddle.net/ecj8n/
$("body").bind( "uirender", function() { $("select").combobox(); $("button").button() ; });
and ajax response do
$.get("someurl", function(html){ $("p").append(html).trigger("uirender"); }
isn't there better approach ?
Comments
Post a Comment