0
我的目标:如果有人从选择框中选择特定值,应该发生某些事情。Jquery mobile&change event&iphone&select
我的环境:
- 的Jquery:1.62
- jQuery Mobile的:1.0B
- iOS版:4.3.5
我被
事件处理程序绑定到选择框$("#location").bind("change", function(event, ui) {
alert("foo");
});
该代码工程无线大概jQuery的移动。这是一个错误或不正确的方法在JQuery的移动事件绑定?
请在下面找到完整的代码示例。
<!doctype html>
<head>
<meta charset="utf-8">
<title>Demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css" />
<script src="http://code.jquery.com/jquery-1.6.2.min.js" type="text/javascript">
</script>
<script src="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js" type="text/javascript"></script>
<script>
$(document).ready(function()
{
$("#location").bind("change", function(event, ui) {
alert("foo");
});
});
</script>
<link rel="stylesheet" href="css/theme-i.css">
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<div id="container">
<form>
<div data-role="page">
<select name="location" id="location" >
<option value="1">Option1</option>
<option value="2">Option2</option>
</select>
</div> <!-- /page -->
</form>
</div><!-- /container -->
</body>
</html>
感谢您指点我正确的方向!我将仔细看看页面概念。注意自我:一个jquery移动页面不是一个普通的html页面! :-) – herrjeh42