Refresh jQuery Mobile elements after adding them to the page using AJAX and PHP -


i have php script render 3 form elements each item in database. example, output this:

<!-- entry 1 --> <div data-role="fieldcontain"> <label for="1-name"></label> <input type="text" name="1-note" id="1-note" data-mini="true" /> </div> <div data-role="fieldcontain"> <label for="1-age"></label> <input type="text" name="1-note" id="1-note" data-mini="true" /> </div> <div data-role="fieldcontain"> <label for="1-description"></label> <input type="text" name="1-note" id="1-note" data-mini="true" /> </div>    ...  <!-- entry n --> <div data-role="fieldcontain"> <label for="n-name"></label> <input type="text" name="n-note" id="n-note" data-mini="true" /> </div> <div data-role="fieldcontain"> <label for="n-age"></label> <input type="text" name="n-note" id="n-note" data-mini="true" /> </div> <div data-role="fieldcontain"> <label for="n-description"></label> <input type="text" name="n-note" id="n-note" data-mini="true" /> </div> 

then on main page, use ajax add php-generated content page...

$(document).on('pageshow', function(){     $("#menu1").bind("change", function() {         $.ajax({              type: "get",               url: "includes/ajax_get_entries.php",              data: "table="+$("#menu1").val(),              success: function(html) {                  $("#wrap").html(html).selectmenu('refresh', true);             }         });     }); });  

... putting php content in between wrapper:

<div data-role="fieldcontain" id="wrap"></div> 

adding page works fine, jquery mobile not update style.

how can make update style?

i cannot use add content site , hide if using .show() , .hide(), need response user on table need use.

you can call

$("#wrap").trigger('create'); 

in success callback.

also see question jquery mobile: markup enhancement of dynamically added content


Comments