Html 单击URL或Href时获取Jquery移动脚本错误(**加载页面时出错**)?
我已经使用jQuery Mobile创建了一个示例web应用程序 我已经创建了两个Html 单击URL或Href时获取Jquery移动脚本错误(**加载页面时出错**)?,html,jquery-mobile,Html,Jquery Mobile,我已经使用jQuery Mobile创建了一个示例web应用程序 我已经创建了两个s;一个包含href,另一个包含内容。当我单击HREF时,它显示jquery移动脚本错误,如下所示: 加载页面时出错 有人能看到是什么导致了这个错误吗 <html> <head runat="server"> <title>How to expand collapse div layer using jQuery</title> &
s;一个包含href,另一个包含内容。当我单击HREF时,它显示jquery移动脚本错误,如下所示:
加载页面时出错
有人能看到是什么导致了这个错误吗
<html> <head runat="server"> <title>How to expand collapse div layer using jQuery</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-.0a3.min.js"></script> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-.0a3.min.css" />
<script language="javascript">
$(document).ready(function () {
var $pages = $('#pages > *').hide();
$('#content a').click(function() {
$pages.hide();
$($(this).attr('href') ).show();
});
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="header" class='header_align'>Bristol-Myers Squibb</div>
<h2>
How to expand collapse div layer using jQuery</h2>
<div id="toggle">
<div id="heading">Heading</div>
<div id="content">
<ul>
<li><a href="#page-1">Page1</a></li>
<li><a href="#page-2">Page2</a></li>
<li><a href="#page-3">Page3</a></li>
</ul>
</div>
</div>
<div id="pages">
<div id="page-1">Page 1 Content</div>
<div id="page-2">Page 2 Content</div>
<div id="page-3">Page 3 Content</div>
</div>
</div>
</body>
</html>
如何使用jQuery展开折叠div层
$(文档).ready(函数(){
var$pages=$(“#pages>*”).hide();
$(“#内容a”)。单击(函数(){
$pages.hide();
$($(this.attr('href')).show();
});
});
百时美施贵宝
如何使用jQuery扩展折叠div层
标题
第1页内容
第2页内容
第3页内容
带有命名锚的链接的jQuery mobile默认行为是跳转到具有相应id的页面(data role=“page”)。但是第1页、第2页或第3页没有此类页面,因此发生错误
试试这个
$(document).ready(function () {
var $pages = $('#pages > *').hide();
$('#content a').click(function() {
$pages.hide();
$($(this).attr('href') ).show();
return false;
});
});
我还要更新几周前发布的jQuery Mobile 1.0决赛。它比您正在使用的alpha版本更稳定、更快、更可靠。