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">
<op开发者_如何学Gotion 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>
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.
From what i know there's no need to use data-role="none"
simply set data-native-menu="true"
will do.
<select data-native-menu="true" name="some-options" id="some-options">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
Sample here
I had the same issue and changing to data-native-menu=false helped, because I don't have SELECT element inside FORM element.
If I understand properly, you should set data-native-menu=true, if you have SELECT inside FORM, based on discussion here:
JQuery Mobile Select Box not working
精彩评论