Skip to content Skip to sidebar Skip to footer

Jquery Styles Not Applied In Dynamically Creation

I created collapsible listview in jquery mobile. It this one as dynamically. If I created collapsible in html code, it display fine. The same one I tried as dynamically, then the

Solution 1:

For dynamically added content you will need to call .collapsible() method:

$('div[data-role=collapsible]').collapsible();

Solution 2:

In jQuery mobile when you add content dynamically you need to initialize the content, or if you are adding content (for example adding items to a listview) you would need to refresh the content.

If you have several items that need to be initialized you can just trigger the create event on the page to initialize all of them. Often its best to do so in the pageshow event.

For example

$("#mypage").on('pageshow', function () {
   $(this).trigger("create");
});

Post a Comment for "Jquery Styles Not Applied In Dynamically Creation"