I am currently using a button which when clicked will either show or hide a paragraph, I was wondering if it is possible to have a link instead of a button here? Obviously there is no onclick attribute for a tag. But I would prefer it was just a link which was clicked rather than a button.
I'll try not to bore you too much with a lot of code. The html looks like this:
function showMore() {
var dots = document.getElementById("dots");
var moreText = document.getElementById("moreInfo");
var moreText2 = document.getElementById("moreInfo2");
var btnText = document.getElementById("moreLess");
if (dots.style.display === "none") {
dots.style.display = "inline";
btnText.innerHTML = "See more information";
moreText.style.display = "none";
moreText2.style.display = "none";
} else {
dots.style.display = "none";
btnText.innerHTML = "See less information";
moreText.style.display = "inline";
moreText2.style.display = "inline";
}
}
<span id="dots">.......</span>
<button onclick="showMore()" id="moreLess">See more Information</button>
<p id="moreInfo" hidden> some text .</p>
<p id="moreInfo2" hidden> some other text</p>
Thanks in advance