function showStuff(id, text, btn) {
document.getElementById(id).style.display = 'block';
// hide the lorem ipsum text
document.getElementById(text).style.display = 'none';
// hide the link
btn.style.display = 'none';
}
// Hide div :
document.getElementById(div_id).style.display = none;
/// Show div :
document.getElementById(div_id).style.display = block;
document.getElementById("test").hidden=true;
document.getElementById("test").hidden=false
//hidden attribute
document.getElementById("the-element-id").hidden=true
document.getElementById("the-element-id").setAttribute("hidden",true)
//style attribute
document.getElementById("the-element-id").style.display="none"
//If you have jquery, you can use the following method:
$("#mydiv").hide(); //hides div.
$("#mydiv").show(); //shows div.
//If you don't have jquery...
//search up the following: html how to add jquery
<td class="post">
<a href="#" onclick="showStuff('answer1', 'text1', this); return false;">Edit</a>
<span id="answer1" style="display: none;">
<textarea rows="10" cols="115"></textarea>
</span>
<span id="text1">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</span>
</td>
<script>
function showStuff(id, text, btn) {
document.getElementById(id).style.display = 'block';
// hide the lorem ipsum text
document.getElementById(text).style.display = 'none';
// hide the link
btn.style.display = 'none';
}
</script>
Check this! https://dev.to/devlorenzo/js-hide-and-show-32og