【发布时间】:2013-01-10 13:47:09
【问题描述】:
我在一个页面上有以下代码:
<!DOCTYPE html>
<html>
<head>
<title>Appski</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="css/style.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="quizPage">
<div data-role="content">
<button id="bigButton"></button>
</div><!-- /content -->
</div><!-- /page -->
</body>
<script>
$(document).ready(function() {
$("#bigButton").html("hello");
$("#bigButton").button('refresh');
});
$("#bigButton").click(function() {
window.location.replace("page2.html");
});
</script>
</html>
当我加载此页面时,它工作正常并在按钮中显示“你好”,但是当我从另一个 jQuery Mobile 页面链接到类似以下源代码的内容时,页面加载时按钮中没有出现任何文本(以及链接也不起作用):
<a href="page1.html" data-role="button">click me</a>
【问题讨论】:
-
可能重复[链接到页面时按钮文本(基于 JSON 调用)未加载] 同一个人提出的相同问题。 (stackoverflow.com/questions/14236170/…)
标签: jquery jquery-mobile