Re: Creating a toggle (show and hide) for hyperlink click
Hi,
I wish to use Jquery. I am a newbie. I have a hyperlink and when a user clicks that I wish to toggel ie. show or hide the text . This is what I have so far.
<a href="#" onclick="toggle("hidden");">FAQ</a>
<div id="hidden">
Some Questions
Some Answers
</div>
<script type="text/javascript" language="javascript">
function toggle(id) {
var state = document.getElementById(id).style.display;
if (state == 'block')
{
document.getElementById(id).style.display = 'none';
}
else
{
document.getElementById(id).style.display = 'block';
}
}
</script>
Any inputs would be greatly appreciated.