Forcing jQuery Mobile to re-evaluate styles/theme on dynamically inserted content

前端 未结 7 987
感情败类
感情败类 2020-11-28 04:40

Objective: Load HTML content via $.ajax, insert it into the DOM, have jQuery Mobile apply theme styles to it.

Problem:

7条回答
  •  猫巷女王i
    2020-11-28 05:28

    If you're using the ajax method to load into content, this is how I got the styling and jquery mobile functionality to work. It's pretty much the same as the suggestion above but for some people you probably like seeing a more full example.

    Here is the code:

    $.ajax({
    url: 'url.php',
    success: function(data) {    
    $("#div").html(data).trigger('create');
    }
    });
    

提交回复
热议问题