案例:jquery案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="/js/jquery-1.11.1.min.js"></script>
5
<script>
6
$(document).ready(function(){
7
  $("button").click(function(){
8
    $("h1,h2,p").addClass("blue");
9
    $("div").addClass("important");
10
  });
11
});
12
</script>
13
<style type="text/css">
14
.important
15
{
16
font-weight:bold;
17
font-size:xx-large;
18
}
19
.blue
20
{
21
color:blue;
22
}
23
</style>
24
</head>
25
<body>
26
27
<h1>标题 1</h1>
28
<h2>标题 2</h2>
29
<p>这是一个段落。</p>
30
<p>这是另一个段落。</p>
31
<div>这是非常重要的文本!</div>
32
<br>
33
<button>向元素添加类</button>
34
35
</body>
36
</html>
37