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
1 parent 807cf7c commit fa3dbf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<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>
<button style="display: none;" onclick="showMoreLess()">See more</button>


<script src="script.js"></script>
Expand Down
7 changes: 6 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ var btn = document.querySelector('button');
var textElement = document.getElementById('text');
var originalText = textElement.innerText;

if (originalText.length > 50) {
textElement.innerText = originalText.slice(0, 50);
btn.style.display = 'block';
}

function showMoreLess() {
if (textElement.innerText.length > 50) {
textElement.innerText = textElement.innerText.slice(0, 50);
Expand All @@ -10,4 +15,4 @@ function showMoreLess() {
textElement.innerText = originalText;
btn.innerText = "See less";
}
}
};

0 comments on commit fa3dbf9

Please sign in to comment.