问题是 Jquery 在 index.html 中正常工作。如果我单击注册按钮,打开 register.html 页面。但这里 Jquery 工作停止了。如果我从头上删除 Mobile Jquery Link 那么一切都会完美运行..
Index.html - index.html 工作完美。
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="js/function.js"></script>
<script src="js/comman_phoneGap.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
Register.html - :问题就在这里。我的脚本出了什么问题
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="js/function.js"></script>
<script src="js/comman_phoneGap.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<form action="" method="post">
<div class="ui-field-contain">
<label for="name">Full Name:</label>
<input type="text" class="form-control" id="username" placeholder="Name">
</div>
<div class="ui-field-contain">
<label for="name">Full Name:</label>
<input type="text" class="form-control" id="email" placeholder="email">
</div>
<div class="ui-field-contain">
<label for="name">Full Name:</label>
<input type="password" class="form-control" id="password" placeholder="Password" />
</div>
<div class="ui-field-contain">
<label for="name">Full Name:</label>
<input type="password" class="form-control" id="cpassword" placeholder="Password">
</div>
<fieldset data-role="controlgroup" data-type="horizontal">
<legend>Select Type</legend>
<input type="radio" class="user_type" id="seller" value="seller">
<label for="seller">Seller</label>
<input type="radio" class="user_type" id="buyer" value="buyer">
<label for="buyer">Buyer</label>
</fieldset>
<button type="submit" onclick="return clicked();" class="btn btn-block btn-success">Register</button>
</form>
<script>
function clicked()
{
alert('hello'); return false;
}
</script>
clicked() function not working here. I am not understand. What is do.
最佳答案
这是临时解决方案..但工作完美..
function redirect(page)
{
$.mobile.changePage(
window.location.href=page,
{
allowSamePageTransition : true,
transition : 'none',
showLoadMsg : false,
reloadPage : true
}
);
}
关于jquery 仅在phonegap 中工作index.html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32069006/