2012-07-06, 06:01 AM
I am using simple javascript toogle function with the following code.
The Problem is if i click on yes, and for some reason i refresh the page, then yes radio button remains checked but moreTxt div hides (i.e. its default visiblity mode) how to tackle with that problem ?
<script>
function add_more(){
if (document.form.more[0].checked==true)
{
document.getElementById('moreTxt').style.display="block";
}
else if (document.form.more[1].checked==true)
{
document.getElementById('moreTxt').style.display="none";
}
}
</script>
do want to enter something more ?
<form name="form">
<input type="radio" value="yes" name="more" onclick="add_more()" /> Yes
<input type="radio" value="No" name="more" onclick="add_more()" /> No
<div id="moreTxt" style="display:none">
hi you can enter more here
<textarea rows="3" cols="4">
</textarea>
</div>
</form>
The Problem is if i click on yes, and for some reason i refresh the page, then yes radio button remains checked but moreTxt div hides (i.e. its default visiblity mode) how to tackle with that problem ?