You Function OptionOne and OptionTwo pass "Element" for CheckBox object
But you are Checking "switchElement".
function OptionOne(Element){
if (Element.value == 'Y') {
document.getElementById("div").style.display = "block";
}else {
document.getElementById("div").style.display = "none";
}
}
Secondly you can use CheckBox's checked property rather than value property.
it would automatically as you check and uncheck , else you have to set value Y and N as you check as Chris mentioned.
Hope this helps.
-***********************
Comment 2 -
Hi
I would just say/suggest please copy paste this code to a html file and run this on any browser
and then start over to think what you need...do the testing on this html page..
<html>
<body>
<script type = "text/javascript">
function CheckOne(ele) {
if (ele.checked) {
document.getElementById("div1").style.display = 'none';
}else {
document.getElementById("div1").style.display = 'block';
}
}
</script>
<div id = "div1">
<input type = "text"> Hello </input>
</div>
<input type = "checkbox" id = "checkbox1" onClick="CheckOne(this);"/>
</body>
</html>
Thanks