→ oToToT: 看不太懂.... 02/11 15:59
推 onininon: jquery語法會失效 有錯誤訊息嗎 02/11 16:05
→ MangoTW: 什麼語法…講清楚一點… 02/12 00:52
推 aspdoctor: 你用到Ajax? 是的話有變動的元素event要重新bind 02/12 02:59
以下是我的程式碼
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HomeGatWay</title>
<link rel="shortcut icon" href="ext/favicon.ico">
<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">
<link rel="stylesheet"
href="ext/css/themes/default/jquery.mobile-1.4.5.min.css">
<link rel="stylesheet" href="templates/style/default.css">
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile-1.4.5.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-position="fixed" data-tap-toggle="false">
<a href="#nav-panel" class="jqm-navmenu-link ui-nodisc-icon ui-alt-icon
ui-btn-left ui-btn ui-icon-bars ui-btn-icon-notext ui-corner-all"
data-role="button" role="button">Menu</a>
<h1><div class="top_user" style="float:right">page_main</div></h1>
</div><!-- /header -->
<div role="main" class="ui-content">
<div class="actionbar">
<div style="float:right;">
<nav>
<a href="?page=roon&action=append">p1</a>
<a href="?page=roon&action=edit&roonno=">p2</a>
<a href="?page=roon&action=cancel&roonno=">p3</a>
<a href="?page=roon&action=delete&roonno=">p4</a>
</nav>
</div>
</div>
</div><!-- /content -->
<script>
$(function(){alert('456');});
</script>
</div><!-- /page -->
</body>
</html>
我用ie/chrome 測過
點P1~P4的超連結 都會有一個超連結點下去後alert('456');會執行不到
按F5重新更新後就會正常跳出alert('456');
最後發現只要把 <script src="js/jquery.mobile-1.4.5.js"></script>這段拿掉就
正常了
※ 編輯: e2755699 (114.35.130.39), 02/12/2015 11:26:02
推 cokellen: 在<a>加上data-ajax="false" 試看看 02/12 11:57
→ cokellen: jquery mobile官方文件有說明Link的使用 02/12 11:58
→ e2755699: 挖~好像有效耶 我找了超久 02/12 13:08