Hello, I'm using php code to retrieving an array from database and place the result into checkboxes but after the last checkbox input there is text input (hidden by default) and the last check box name is 'other'. I want to make the text in visible if 'other' is checked i used this code:
<script type="text/javascript">
if (document.getElementById('other').checked = true) {
document.getElementById('whatever').style.visibility = "visible";
} else {
document.getElementById('whatever').style.visibility = "hidden";
}
</script>
<input name="pVital[]" type="checkbox" id="pVital[]" value="I & O" checked="<?php if (in_array('I & O', $pvitals)) echo "checked"; else echo "unchecked"; ?>" />I & O<br/>
<input <?php if (in_array('Daily Weight', $pvitals)) echo "checked"; else echo "unchecked"; ?> name="pVital[]" type="checkbox" id="pVital[]" value="Daily Weight" />Daily Weight<br/>
<input <?php if (in_array('Foley Catheter', $pvitals)) echo "checked"; else echo "unchecked"; ?> name="pVital[]" type="checkbox" id="pVital[]" value="Foley Catheter" />Foley Catheter<br/>
<input <?php if (in_array('other', $pvitals)) echo "checked"; else echo "unchecked"; ?> name="pVital[]" type="checkbox" id="other" value="other" />Other<br/>
<input name="pVital[]" type="text" id="whatever" style="visibility: hidden;" value="<?php if (in_array('other', $pvitals)) echo end($pvitals); ?>">
but this is not work :(
Just i want to make this text input visible whenever 'other' is checked and not necessary wither event is occurred or not.