我无法使它工作。具有jqm data-native-menu =“false”的php数组不显示所有项目,但仅显示第一个和最后一个。如果data-native-menu =“true”,则显示所有项目。我该如何解决它?jquery mobile select data-native-menu =“false”并且php数组不工作
<?php
$fooArray = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday');
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="js/jquery.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
</head>
<body>
<section id="main" data-role="page">
<header data-role="header" data-theme="b"><h1></h1></header>
<div data-role="content">
<div data-role="fieldcontain">
<label for="select-choice-1" class="select">Choose the day:</label>
<select name="select-choice-1" id="select-choice-1" data-native-menu="false">
<?php foreach ($fooArray as $value) { echo '<option value=>'.$value.'</option>'; } ?>
</select>
</div>
</div>
<footer data-role="footer" data-theme="b"><h1></h1></footer>
</section>
</body>
这并不像你与你的PHP循环使得特别有效的HTML。当你将'
不管它是php还是js数组,效果都是一样的。在这里,你有http://jsfiddle.net/WGCYD/ with data-native-menu =“false”,在这里http://jsfiddle.net/WGCYD/1/ with data-native-menu =“true” - “真“显示内容。我确实需要有一个数组,因为选项数量未知。 – Avyakt 2012-04-21 21:22:19
我的建议是修正你的HTML是有效的,这是codaniel几个小时后提出的建议。 – Jasper 2012-04-22 16:14:54