Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ If there's anything that you think could be improved due to misunderstanding, th
# The 1000 Things
Structure of the repo Things are as *folder > main js file*, along with the supporting HTML and CSS files.

(6) Name Changer > namechange.js <br>
(5) Message Changer > messageChanger.js <br>
(4) Time of Day > timeOfDay.js <br>
(3) VAT Calculator > vat-script.js <br>
Expand Down
16 changes: 16 additions & 0 deletions nameChange/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html>

<head>
<title>Name Changer</title>
</head>

<body>
<h1>Click the <b>bold</b> text below.</h1>

<p>Once upon a time, <b class="para"> a brave adventurer</b> sought fame and fortune.</p>
<p>Little did <b class="para">the adventurer</b> know that others sought the same and soon their paths would cross.</p>

<script src="namechange.js"></script>

</body>
</html>
9 changes: 9 additions & 0 deletions nameChange/namechange.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let yourname = prompt("Enter your name");

const names = document.querySelectorAll(".para");

for(let i=0; i<names.length; i++) {
names[i].addEventListener("click", function(){
names[i].innerHTML = yourname;
});
}