Skip to content

Commit fe3e92f

Browse files
committed
update
1 parent dd3eecd commit fe3e92f

File tree

4 files changed

+39
-17
lines changed

4 files changed

+39
-17
lines changed

慕课网教程案例/jQuery入门教程/jQuery表单事件/select.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,37 @@
2727
height: 100px;
2828
}
2929
</style>
30-
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
30+
<script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
3131
</head>
3232

3333
<body>
3434
<h2>input与textarea</h2>
3535
<div class="left">
36+
<h4>测试一</h4>
3637
<div class="aaron">
37-
用鼠标选中文字:input
38-
<input type="text" value="Hello 慕课网" />
38+
选中文字:input
39+
<input type="text" value="慕课网" />
3940
</div>
41+
<button id="bt1">触发input元素的select事件</button>
42+
43+
<h4>测试二</h4>
4044
<div class="aaron">
4145
textarea:
4246
<textarea rows="3" cols="20">用鼠标选中文字</textarea>
4347
</div>
4448
</div>
49+
4550
<script type="text/javascript">
51+
4652
//监听input元素中value的选中
47-
$('input').select(function(e) {
48-
alert(e.target.value);
49-
});
53+
//触发元素的select事件
54+
$("input").select(function(e){
55+
alert(e.target.value)
56+
})
57+
$("#bt1").click(function(){
58+
$("input").select();
59+
})
60+
5061

5162
//监听textarea元素中value的选中
5263
$('textarea').select(function(e) {

慕课网教程案例/jQuery入门教程/jQuery表单事件/submit.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,22 @@
2727
height: 100px;
2828
}
2929
</style>
30-
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
30+
<script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
3131
</head>
3232

3333
<body>
3434
<h2>submit</h2>
3535
<div class="left">
3636
<div class="aaron">
37-
<form id="target1" action="test.html">
38-
回车键或者点击提交表单
37+
<form id="target2" action="destination.html">
38+
回车键或者点击提交表单,禁止浏览器默认跳转:
3939
<input type="text" value="输入新的值" />
4040
<input type="submit" value="Go" />
4141
</form>
4242
</div>
4343
<div class="aaron">
44-
<form id="target2" action="destination.html">
45-
回车键或者点击提交表单,禁止浏览器默认跳转:
44+
<form id="target1" action="test.html">
45+
回车键或者点击提交表单
4646
<input type="text" value="输入新的值" />
4747
<input type="submit" value="Go" />
4848
</form>

慕课网教程案例/jQuery入门教程/jQuery遍历/next方法.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
display: block;
2626
}
2727
</style>
28-
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
28+
<script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
2929
</head>
3030

3131
<body>

慕课网教程案例/jQuery入门教程/jQuery键盘事件/keydown()与keyup()事件.html

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,35 @@
2323
color: red;
2424
}
2525
</style>
26-
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
26+
<script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
2727
</head>
2828

2929
<body>
30-
<h2>keydown</h2>
30+
<h2>keydown()与keyup()事件</h2>
3131
<div class="left">
32+
<h4>测试一</h4>
3233
<div class="aaron">监听keydown输入:
3334
<input class="target1" type="text" value="" /><br />
34-
显示输入的值:<em>1</em>
35+
按下显示输入的值:<em></em>
36+
</div>
37+
<h4>测试二</h4>
38+
<div class="aaron">监听keyup输入:
39+
<input class="target2" type="text" value="" /><br />
40+
松手显示输入的值:<em></em>
3541
</div>
36-
3742
</div>
3843

3944
<script type="text/javascript">
4045
//监听键盘按键
4146
//获取输入的值
4247
$('.target1').keydown(function(e) {
43-
$("em").text(e.target.value)
48+
$("em:first").text(e.target.value)
49+
});
50+
51+
//监听键盘按键
52+
//获取输入的值
53+
$('.target2').keyup(function(e) {
54+
$("em:last").text(e.target.value)
4455
});
4556

4657
</script>

0 commit comments

Comments
 (0)