Skip to content

Commit cca668d

Browse files
jquery basics
Signed-off-by: Arnav Gupta <[email protected]>
1 parent c01047a commit cca668d

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

Lecture08/jquery/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
9+
<script defer src="script.js"></script>
10+
</head>
11+
<body>
12+
<h1>My Page</h1>
13+
14+
<div class="cl1">this is a div</div>
15+
<div>this is a div</div>
16+
<div class="cl1">this is a div</div>
17+
<div>this is a div</div>
18+
19+
<p> this is a para </p>
20+
<p class="cl1"> this is a para </p>
21+
<p> this is a para </p>
22+
<p class="cl1"> this is a para </p>
23+
</body>
24+
</html>

Lecture08/jquery/jquery.console.log

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
$('.cl1').text('adgadsgadg')
2+
Object { 0: div.cl1, 1: div.cl1, 2: p.cl1, 3: p.cl1
3+
, length: 4, prevObject: Object(1) }
4+
5+
$('.cl1')[0].text('adgadsgadg')
6+
TypeError: $(...)[0].text is not a function
7+
debugger eval code:1:14
8+
$('.cl1').text('adgadsgadg')
9+
Object { 0: div.cl1, 1: div.cl1, 2: p.cl1, 3: p.cl1
10+
, length: 4, prevObject: Object(1) }
11+
12+
$($('.cl1')[0]).text('adgadsgadg')
13+
Object [ div.cl1
14+
]
15+
16+
$($('.cl1')[0]).text('fdhjmrhkrhkjykr')
17+
Object [ div.cl1
18+
]
19+
20+
document.getElementsByClassName('cl1')
21+
HTMLCollection(4) [ div.cl1, div.cl1, p.cl1, p.cl1
22+
]
23+
24+
document.getElementsByClassName('cl1')[1]
25+
<div class="cl1">
26+
27+
$(document.getElementsByClassName('cl1')[1])
28+
Object [ div.cl1
29+
]
30+
31+
$(document.getElementsByClassName('cl1')[1]).text('gtnegen')
32+
Object [ div.cl1 ]

Lecture08/jquery/script.js

Whitespace-only changes.

0 commit comments

Comments
 (0)