I am quite new to jQuery and are currently despairing of trying to insert a dynamically created expander into a jQuery-Mobile page which looks like the following:
<div data-role="page" id="myPage">
As the expander should be inserted into "myContainer", I am writing:
var expander = $("<div data-role='collapsible' data-collapsed='true'><h3 class='category' /><div class='content' /></div>");
However, only a unthemed and not collapsible div appears in my document.
I guess, I will have to manually toggle the creation of the expander similar to refreshing a listview - I did not find anything about that in the documentation, however.
seems to exist.
Many thanks in advance for your responses!
This question is in fact a duplicate happening so often that I created a FAQ about it.
You need to use
.page() on the topmost element that you add to DOM.
See here for details: http://jquerymobiledictionary.dyndns.org/faq.html
I have also reached the moment when I wanted to use
.page inside a
page* event and the solution was rather obvious to me - use a semaphore.
If you don't know how to implement a semaphore, see my dual column plugin code as an example (it's on the same site)