Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
codewithmoiz authored Jan 14, 2024
0 parents commit 807cf7c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.html
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>
13 changes: 13 additions & 0 deletions script.js
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";
}
}

0 comments on commit 807cf7c

Please sign in to comment.