我认为焦点事件不适用于JQuery移动:这是我的代码?你怎么想它,谢谢你。
(当我删除调用库jQuery Mobile的,它的工作原理)。焦点()与JQUERY MOBILE的问题?
<!DOCTYPE html>
<html>
<head>
<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"></script>
<script src="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function() {
$('#acceuil').live('pagecreate', function(event) {
$('#declencher').click(function() {
$('#cache').focus();
});
$('#declencher').trigger('click');
});
});
</script>
<body>
<div data-role="page" id ="acceuil" >
<div data-role="header" data-theme="a" ><h3>aaa</h3></div>
<div data-role="content">
<input id="cache" type="input">
<input type="button" id="declencher" value="declencher">
</div><!-- content-->
<div data-role="footer" data-theme="a" data-position="fixed"><h3> Footer </h3></div>
</div>
</body>
</html>
更清洁的问题通常得到更快的回答.... –
你试过去除'$(document).ready()'?按照doco的建议,你应该将事件绑定到'pagecreate'而不是'document.ready'。 –
谢谢你的写作,我想我的问题是明确的人!我已经删除了$(document).ready()但它没有工作,我认为focus()不支持jquery mobile –