jQuery Mobile 1.2.0
I generate the HTML using JavaScript ($(selector).html(content)
), add it to the DOM and then display it ($.mobile.changePage()
).
Then I invoke an AJAX call, get some data, and re-generate the html (but the parent element, the same $(selector)
, stays the same, I just change its html(...)
).
At this poing the HTML is not "enhanced" by jQM, no styling applied on it.
Now according to the docs I should simply call the page()
function on the parent element, i.e $(selector).page()
.
Other places in the docs suggest triggering the create
event, i.e $(selector).trigger("create")
.
The problem is that non of the above two methods works - the styling of jQM is not applied.
Looking at the code of jQM, I've tried triggering the pagecreate
event on that element and it does work, but, this is not documented anywhere, so I'm uncertain of it, especially concerning future releases of jQM.
At some poing in the docs I've read that I can call page()
on a page only once..
Anyway, is there any concise/standard way to tell jQM to "enhance" the whole element and its child-elements? Or should I simply stay with triggering the pagecreate
event?
Thank you!