实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js">
5
</script>
6
<script>
7
function alertMe()
8
{
9
alert("Hello World!");
10
}
11
$(document).ready(function(){
12
  $("p").click(alertMe);
13
  $("button").click(function(){
14
    $("p").unbind("click",alertMe);
15
  });
16
});
17
</script>
18
</head>
19
<body>
20
21
<p>This is a paragraph.</p>
22
<p>This is another paragraph.</p>
23
<p>Click any p element to trigger an alert box.</p>
24
<button>Remove the alert box function from the click event for the p elements</button>
25
26
</body>
27
</html>