Elliot Bonneville
Elliot Bonneville

Reputation: 53291

How to use jQuery Mobile selector menus?

I've finally found the HTML for the jQuery Mobile selector menu component, thanks to my other question, but I'm stuck again.

I'm currently using this code, which works nicely:

<div data-role="content">   
    <div data-role="fieldcontain"> 
        <label for="select-choice-nc" class="select">Font Choice:</label> 
        <select name="select-choice-4" id="select-choice-nc"> 

            <option value="arial">Arial</option> 
            <option value="papyrus">Papyrus</option> 
            <option value="helvetica">Helvetica</option> 
            <option value="calibri">Calibri</option> 

        </select> 
    </div> 
</div><!-- /content -->

But how do I tell which option has been selected?

Upvotes: 1

Views: 905

Answers (1)

Matt Ball
Matt Ball

Reputation: 359776

It's just like jQuery sans Mobile (perhaps jQuery Immobile?). As with other form elements, use .val() to get the value of the <select>:

$('#select-choice-nc').val();

Upvotes: 2

Related Questions