I have successfully implemented the expandable feature, but I am looking for a way to make the "read more..." link disappear once it is clicked. Despite browsing through StackOverflow for code and solutions, I cannot seem to find a solution that makes the link vanish.
Here is the code snippet:
<p style="text-align: center; font-size:18px; font face=nerislight; color:#009cdc">Test title test title test title</p>
<script type="text/javascript">
function toggleMe(a){
var e=document.getElementById(a);
var i = document.getElementById(a + '_image');
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block"} else {
e.style.display="none"}
return false;
}
</script>
Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy Test copy </p>
<p style="text-align: center; font-size:14px; font face=nerislight"><a style="cursor:pointer;" onclick="return toggleMe('landworks')">Read more...</a>
<div id="landworks" style="display:none;">Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion </p>
<strong>More Expansion</strong>Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion Expansion </p>
<p style="text-align: center;">Call to Action</p>
<div class="mk-button-align center"><a href="http://atestpage.com" id="123" class="mk-button dark button-190 light-color mk-shortcode three-dimension small ">Contact us today!</a></div>
<style type="text/css">
.button-190 {
margin-bottom: 0px;
margin-top: 0px;
}
.button-190 {
background-color:#009cdc;
}
.button-190:hover {
background-color:#0091cd;
}
.button-190.three-dimension {
box-shadow: 0px 3px 0px 0px #007db0;
}
.button-190.three-dimension:active {
box-shadow: 0px 1px 0px 0px #007db0;
}
</style>
</div>
Essentially, I want the "read more..." link to disappear once clicked so that it looks like regular text. Currently, the link remains visible on the page after clicking, causing an awkward break in the content. Can anyone provide assistance with this issue?
PS: I would love to showcase it on JSFiddle for better understanding, but I am new to JavaScript and uncertain how to do so.