开发者

How to use jQuery Mobile selector menus?

开发者 https://www.devze.com 2023-03-02 18:18 出处:网络
I\'ve finally found the HTML for the jQuery Mobile selector menu component, thanks to my other question, but I\'m stuck again.

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</opti开发者_C百科on> 
            <option value="calibri">Calibri</option> 

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

But how do I tell which option has been selected?


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();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号