Javascript jqueryid和函数
请帮帮我。我有个问题 e、 g 你好,世界 $'clickmenow'。单击函数{ window.alertDO; };Javascript jqueryid和函数,javascript,jquery,html,Javascript,Jquery,Html,请帮帮我。我有个问题 e、 g 你好,世界 $'clickmenow'。单击函数{ window.alertDO; }; 问题来自于添加jQuery的移动版本。在包含jquery mobile之前,请尝试添加此脚本 <script> $(document).bind('mobileinit',function(){ $.mobile.changePage.defaults.changeHash = false; $.mob
问题来自于添加jQuery的移动版本。在包含jquery mobile之前,请尝试添加此脚本
<script>
$(document).bind('mobileinit',function(){
$.mobile.changePage.defaults.changeHash = false;
$.mobile.hashListeningEnabled = false;
$.mobile.pushStateEnabled = false;
});
</script>
以下是完整的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<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/jquery-1.11.1.min.js"></script>
<script>
$(document).bind('mobileinit',function(){
$.mobile.changePage.defaults.changeHash = false;
$.mobile.hashListeningEnabled = false;
$.mobile.pushStateEnabled = false;
});
</script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<body>
<input type="button" id="clickmenow" value="ADD" />
<script type="text/javascript">
$('#clickmenow').click(function() {
window.alert("DO IT");
});
</script>
</body>
</html>
所以我没有足够的声誉来评论一篇文章。但在safari中调试的一个好方法是进入首选项,然后在最底部的首选项高级部分有一个复选框,上面写着“在菜单栏中显示开发菜单”。确保选中此框 之后,转到菜单栏的“开发”部分,选择“显示错误控制台”选项。这将显示您遇到的错误 下面是错误控制台的图片和错误示例。错误以红色文本显示 至于代码的问题,实际上您没有包含到jQuery库的链接。你可以用几种方法来做到这一点。前面建议的方法只有在您有internet连接时才起作用。如果需要,您可以从他们的网站下载jQuery库并将其保存到您的网站文件夹中。然后,您只需使用脚本标记链接到该文件,就像链接到任何其他外部javascript文件一样 jQuery下载页面: 例如:
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../jquery-ui-1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="../js/blur.js"></script>
您忘记导入jQuery。jQuery库丢失。请确保在标记之前包含。对于将来,请确保您说出问题所在,而不仅仅是它不起作用以及询问此代码不起作用!!为什么?我补充说,这不是工作:你得到了什么错误?你有css文件吗?是的,现在它的工作!但是为什么呢?怎么做?谢谢你,你是男人!真正地