Using the visibility
property only affects the visibility of the elements on the page; they will still be there in the page layout. To completely remove the elements from the page, use the display
property.
display:none // for hiding
display:block // for showing
Make sure to change your css file to use display instead of visibility too.
As for the javascript (this is not jQuery), make sure you hide the options by default when the page loads:
<script type="text/javascript">
window.onload = function() {
document.getElementById('ifYes').style.display = 'none';
}
function yesnoCheck() {
if (document.getElementById('yesCheck').checked) {
document.getElementById('ifYes').style.display = 'block';
}
else {
document.getElementById('ifYes').style.display = 'none';
}
}
</script>
If you haven't done so already, I would recommend taking a look at jQuery. jQuery code is much clearer and easier to write and understand.