JSFiddle - React, Tailwind, and code Playground

by sunil puvvada

HTML

<p>Lorem ipsum dolor sit amet</p><p id="textarea" style="display: none">Here is some text that I want added to the HTML file
</p>
<a id="seeMore" onclick="toggleSeeMore()" href="javascript:void(0);">See More</a>

JavaScript

function toggleSeeMore() {
    if(document.getElementById("textarea").style.display == 'none') {
        document.getElementById("textarea").style.display = 'block';
        document.getElementById("seeMore").innerHTML = 'See less';
    }
    else {
        document.getElementById("textarea").style.display = 'none';
        document.getElementById("seeMore").innerHTML = 'See more';        
    }
}