JSFiddle - React, Tailwind, and code Playground

by akhikhl

HTML

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>
<p>
Here is some more text

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';        
    }
}