我在 header 中引用以下 jquery 文件:
<link rel='stylesheet' href='$root/css/jquery.mobile-1.3.2.min.css'>
<script type='text/javascript' src='$root/js/jquery.mobile-1.3.2.min.js'>
</script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'>
</script>
我收到以下错误:
a is undefined
该错误引用了整个 jquery.mobile-1.3.2.min.js 文件。
有什么想法为什么会发生这种情况吗?
最佳答案
脚本的顺序错误。同时关闭link
标记。
jQuery mobile 以 jQuery 命名。
这是CDN 托管的文件
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
从你的角度来看:
<link rel='stylesheet' href='$root/css/jquery.mobile-1.3.2.min.css'/>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'>
</script>
<script type='text/javascript' src='$root/js/jquery.mobile-1.3.2.min.js'>
</script>
关于jQuery 移动引用错误 "a is undefined",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18371952/