Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one render jQuery Mobile UI Object post page load

I have some HTML that I'm generating using JS on the client side. I'd still like to apply the style and functionality of jQuery Mobile UI to those objects as well. I can't seem to figure out how though...

Say I generate a:

<div data-role="fieldcontain">
    <label for="select-choice-1" class="select">Choose shipping method:</label>
    <select name="select-choice-1" id="select-choice-1">
        <option value="standard">Standard: 7 day</option>
        <option value="rush">Rush: 3 days</option>
        <option value="express">Express: next day</option>
        <option value="overnight">Overnight</option>
    </select>
</div>

And want to render it via jQuery Mobile UI inside a page... how would one do that?

I know with standard jQuery UI I'd just have to make a call along the lines of:

$("#select-choice-1").buttonset();

Is there something like this for jQuery Mobile UI?

like image 520
Serhiy Avatar asked Oct 14 '22 18:10

Serhiy


1 Answers

UPDATE!

Yeah! The new implementation with event just landed!

http://jquerymobile.com/blog/2011/07/22/jquery-mobile-team-update-week-of-july-18th/

Now in beta2 there will be a create event that triggered on an element will cause its rendering.

I will update the faq when beta2 ships.

Find the topmost element you add to DOM and call .page() on it. This question in fact duplicates a lot of other questions tagged jquery-mobile, therefore I created a shot tutorial not to describe it again every time.

See first post here: http://jquerymobiledictionary.dyndns.org/faq.html

like image 65
naugtur Avatar answered Oct 18 '22 01:10

naugtur