-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 807cf7c
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
|
||
<p id="text">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolor reiciendis nihil repellendus? Minima temporibus ullam impedit quasi placeat iure labore dicta ipsa, deserunt dolorem incidunt quis dolore quia quae dolor fugiat excepturi hic sunt, suscipit officia natus. Odit laborum dolorem cupiditate non minima, eos repudiandae suscipit. Quam perspiciatis voluptas dolorem corporis minima ea excepturi rem possimus enim tempore, qui officiis exercitationem cupiditate quibusdam officia delectus sit maxime fugit saepe aperiam eum mollitia aspernatur veritatis deserunt! Repudiandae dolorem deleniti deserunt. Mollitia quibusdam aliquam libero porro tempora sequi facere blanditiis officiis quam nisi, magni consequuntur, facilis animi, ipsam culpa dicta hic voluptatibus. Maxime autem placeat eaque, natus cum facere neque dolorum accusamus veniam tempora dicta esse consectetur rerum excepturi modi vel id porro ab quae labore dolores quos sit. Eligendi dignissimos quis repellendus maiores ipsum modi et fugiat quam corporis voluptate officia vitae laborum quibusdam, sint cum ad repudiandae excepturi dolore reiciendis!</p> | ||
<button onclick="showMoreLess()">Click</button> | ||
|
||
|
||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var btn = document.querySelector('button'); | ||
var textElement = document.getElementById('text'); | ||
var originalText = textElement.innerText; | ||
|
||
function showMoreLess() { | ||
if (textElement.innerText.length > 50) { | ||
textElement.innerText = textElement.innerText.slice(0, 50); | ||
btn.innerText = "See more"; | ||
} else { | ||
textElement.innerText = originalText; | ||
btn.innerText = "See less"; | ||
} | ||
} |