Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e7f2f9f

Browse files
Changing page content 🧑🏽‍💻✨
1 parent add81eb commit e7f2f9f

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Hello World!</title>
8+
</head>
9+
10+
<body>
11+
12+
<div class="content">
13+
<div class="firstContentDiv">
14+
<h5>Header is this!</h5>
15+
</div>
16+
<div class="secondContentDiv">
17+
<h2 id="page-title">Head Title</h2>
18+
</div>
19+
<div class="thirdContentDiv">
20+
<p> Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer
21+
took a galley of type and scrambled it to make a type specimen book. It has survived not only five
22+
centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was
23+
popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more
24+
recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
25+
</div>
26+
<div class="fourthContentDiv">
27+
<h5>This is footer</h5>
28+
<h2>Baba papki nam</h2>
29+
</div>
30+
</div>
31+
32+
<script src="./script.js"></script>
33+
34+
</body>
35+
36+
</html>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
document.write("Changing page content in HTML using JavaScript!" + "<br /><br />");
2+
3+
4+
5+
6+
7+
let paragraphDiv = document.getElementsByClassName("thirdContentDiv");
8+
console.log(paragraphDiv);
9+
10+
// Using innerHTML you can change inner value of mentioned tag. In below we change full thirdContentDiv content using innerHTML
11+
paragraphDiv[0].innerHTML = "<p>Pragraph was changed to this sentence using Javascript.</p>"
12+
13+
// Using textContent you can change inner text value of mentioned tag.
14+
let myTitle = document.getElementById("page-title");
15+
myTitle.textContent = "Yo Guys, Get Ready to learn!";

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /