/
jquerymobile_button_test_9.htm
45 lines (45 loc) · 1.88 KB
/
jquerymobile_button_test_9.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta http-equiv="cache-control" content="no-cache">
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet">
</head>
<body>
<!-- 第一頁頁面 -->
<section data-role="page" id="page1">
<header data-role="header">
<h1>按鈕測試</h1>
</header>
<article data-role="content">
<!-- 套用 class="ui-disabled" -->
<a href="#" data-role="button" data-icon="alert" class="ui-disabled">注意</a>
<button data-icon="check" class="ui-disabled">選取</button>
<!-- 呼叫 addClass("ui-disabled") -->
<a href="#" data-role="button" data-icon="grid" id="grid">格子</a>
<button data-icon="star" id="star">星號</button>
<!-- 呼叫 attr("disabled", true) : 僅表單按鈕有效 -->
<a href="#" data-role="button" data-icon="search" id="search">搜尋</a>
<button data-icon="gear" id="gear">設定</button>
<!-- 套用 disabled 屬性 : 僅表單按鈕有效 -->
<a href="#" data-role="button" data-icon="home" disabled>首頁</a>
<button data-icon="info" disabled>訊息</button>
</article>
<footer data-role="footer">
<h3>頁尾</h3>
</footer>
</section>
<script>
$(document).on("pageinit", "#page1", function(e){
$("#grid").addClass("ui-disabled");
$("#star").addClass("ui-disabled");
$("#search").attr("disabled", true); //無效
$("#gear").attr("disabled", true);
});
</script>
</body>
</html>