-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jquery_DOM_TiepTheo.html
47 lines (37 loc) · 1.29 KB
/
Jquery_DOM_TiepTheo.html
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
46
47
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>;
<script>
$(document).ready(function(){
$("#btn1").click(function(){
$("#test1").text("Text đã được thay thế rồi - Myclass.vn");
});
$("#btn2").click(function(){
$("#test2").html("<b>Lập trình myclass.vn đã được thay thế</b>");
});
$("#btn3").click(function(){
$("#test3").val("Huỳnh Duy Anh - Full Stack Web Developer");
});
$("#btn4").click(function(){
$("#test4").attr("href","https://mp3.zing.vn");
});
});
</script>
</head>
<body>
<p id="test1">Text này sẽ được thay thế</p>
<p id="test2">Text này sẽ được thay thế bằng HTML</p>
<p>Họ và tên: <input type="text" id="test3" value="Huỳnh Duy Anh"></p>
<p><a href="https://www.facebook.com" id="test4">Facebook.com</a></p>
<button id="btn1">Gán Text</button>
<button id="btn2">Gán HTML</button>
<button id="btn3">Gán Value</button>
<button id="btn4">Thay đổi thuộc tính href</button>
</body>
</html>