Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery Mobile native select not working on droid

This is absolutely driving me crazy. I have the Droid X 2.3.3. For some reason the native select menus will not open when data-role="none" or "data-native-menu="true" are set. Does anyone have any idea why this is happening?

<!DOCTYPE HTML>

<html>
    <head>
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
        </head>
    <body>
        <div id="wrapper-div">
            <div data-role="page" data-theme="b"> 
                <div data-position="inline" data-role="header">                
                    <h1>Test Page</h1>
                </div>
                <div id="content" data-role="content">               
                    <form action="" method="post">
                        <fieldset data-role="fieldcontain">
                        <label for="some-options">Some Options:</label>
                            <select data-native-menu="true" name="some-options" id="some-options">
                                <option value="1">Option 1</option>    
                                <option value="2">Option 2</option>      
                            </select>
                        </fieldset>

                        <fieldset data-role="fieldcontain">
                        <label for="mote-options">More Options:</label>
                            <select data-role="none" name="more-options" id="more-options">
                                <option value="1">Option 1</option>    
                                <option value="2">Option 2</option>      
                            </select>
                        </fieldset>

                        <fieldset data-role="fieldcontain">
                        <label for="evenmore-options">Even More Options:</label>
                            <select name="more-options" id="evenmore-options">
                                <option value="1">Option 1</option>    
                                <option value="2">Option 2</option>      
                            </select>
                        </fieldset>
                    </form>
                </div>
            </div>    
        </div>
    </body>
</html>
like image 765
Micah Avatar asked Jun 14 '11 21:06

Micah


1 Answers

I've experienced the same thing. You need to keep the data-type="page" directly under <body>. See this jQM-issuefor more details: https://github.com/jquery/jquery-mobile/issues/1051

So, remove the <div id="wrapper-div"> - you don't need it anyway ;-) However, I believe that jQM shouldn't put these kinds of restraints on us developers. After all, it does work on an iPhone, so I'm quite curious to why it doesn't work properly on Android.

like image 109
hnilsen Avatar answered Sep 19 '22 15:09

hnilsen