博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
delegate的用法
阅读量:7080 次
发布时间:2019-06-28

本文共 1088 字,大约阅读时间需要 3 分钟。

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
<!DOCTYPE html PUBLIC 
"-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
    
<meta http-equiv=
"Content-Type" 
content=
"text/html;charset=UTF-8" 
/>
    
<title></title>
    
<script type=
"text/javascript" 
src=
"jquery1.5.js"
></script>
    
<script type=
"text/javascript"
>
        
$(document).ready(
function
(){
            
$(
"b"
).live(
"click"
,
function
(){
                
alert($(
this
).text());
            
});
                                    
            
//$("p").live("click",function(){
            
//  $(this).after("<b>I love weiyuan</b>");
            
//});
                                    
            
$(document).delegate(
"p"
,
"click"
,
function
(){
                
$(
this
).after(
"<b>I love weiyuan</b>"
);
            
});
                                    
            
$(
"div"
).delegate(
"input"
,
"click"
,
function
(){
                
$(
"div>p"
).slideToggle();
            
});
        
});
                                
                                    
    
</script>
</head>
<body>
    
<p>hanchao</p>
                            
    
<div style=
"background-color:pink;"
>
        
<p>This is a demo 
for 
delegate!!</p>
        
<input type=
"button" 
value=
"clickme" 
/>
    
</div>
</body>
</html>

     本文转自韩立伟 51CTO博客,原文链接:http://blog.51cto.com/hanchaohan/1204838,如需转载请自行联系原作者

你可能感兴趣的文章
asp.net core 2.0 bundleconfig.json
查看>>
linux扩展根分区详细步骤
查看>>
监控数据库服务器的shell脚本
查看>>
Android 项目开发建议标准规范
查看>>
交换机802.1X认证配置
查看>>
苹果谷歌诺基亚50年后的LOGO会变成啥样?
查看>>
烂在肚子里的救命知识!看看吧!
查看>>
week 3
查看>>
导出的Java程序无法连接数据库的问题解决方案
查看>>
Windows Linux系统U盘制作工具
查看>>
oracle体系结构之 DB高速缓存池
查看>>
我的友情链接
查看>>
华为Agile Controller-Campus web界面admin管理员密码不对无法登陆
查看>>
遇到多个构造器参数时要考虑用构建器
查看>>
windos 8 虚拟光驱/硬盘技术
查看>>
WLC和汇聚交换机的配置
查看>>
使用python-gitlab的API V4来批量创建projects
查看>>
CLR.Via第三版第二章 生成、打包、部署和管理i应用程序及类型(
查看>>
Play Framework 2.3.x开始
查看>>
rz sz上传下载工具使用指南
查看>>