I know this is a question that's been asked a hundred times but I can't figure out why it's not working on me site.
Javascript:
<script>
function show(boxid){
document.getElementById(boxid).style.visibility="visible";
}
function hide(boxid){
document.getElementById(boxid).style.visibility="hidden";
}
</script>
HTML (PHP generated):
echo '<div id="selectedBookingActionLink">';
echo '<a href="#" onClick="show(cancelPopUp)">Cancel</a>';
echo '</div>';
echo '<div id="cancelPopUp">';
echo '<div class="question">Cancel?</div>';
echo '<div class="answer">Yes</div>';
echo '<div class="answer">No</div>';
echo '</div>';
CSS:
#cancelPopUp
{
width: 260px;
height: 80px;
visibility: hidden;
}
As you can see, I'm trying to change the visibility property of the cancelPopUp div when the user clicks the "Cancel" link. I've done some research and found that why I'm doing should work. Yet the pop up box does not appear.
display: nonefor hiding a div than usingvisibility: hiddenbecause the latter only makes it invisible but the height will be used.