-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdom.html
38 lines (32 loc) · 1.29 KB
/
dom.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
<html>
<head>
<title> Default HTML</title>
<link rel="stylesheet" href="../css/style.css">
<!--
text(),html(),attr(),css()
-->
</head>
<body>
<h2>JQuery DOM Manipulation</h2>
<button id="btn1">Text method</button>
<button id="btn2">HTML method</button>
<div id="div1" class="mydiv">
<p class="pclass" id="p1">This is JQuery dom <b>manipulation </b>inside para tag</p>
</div>
</body>
<script src="../jquery/jquery.js"></script>
<script>
$(document).ready(function(){
$("#btn1").click(function(){
// alert($("#p1").text()); //working as gettter
//working as setter
$("#p1").text("Hello <b>Trupti<b>. this is text method");//shows html tags also as it is
alert($('#div1').css("border"))
});
$("#btn2").click(function(){
$("#p1").html("html<b> method<b>"); //shows html tags also
alert($('#p1').attr("class")); //gives the attr name
});
});
</script>
</html>