Here is my code. Please kindly help me because I don't have any basic Javascript programming. The second element and button did not appear if user NOT SELECT OTHERS from first drop down list. Then the selection couldn't submit because the button didn't appear. If user select OTHERS from first drop down list, the second element and button will be appear or visible. What is causing this?
<html>
<head>
<title></title>
<script>
function checkchange() {
if (document.getElementById('favouritecolour').value == 'OTHERS') {
document.getElementById('other').style.display='block';
} else {
document.getElementById('other').style.display='none';
}
};
function check() {
if (document.getElementById('pets').value == 'OTHERS') {
document.getElementById('besides').style.display='block';
} else {
document.getElementById('besides').style.display='none';
}
};
</script>
</head>
<body>
<select id='favouritecolour' onChange='checkchange()'>
<option value='BLUE'>BLUE</option>
<option value='RED'>RED</option>
<option value='OTHERS'>OTHERS</option>
</select>
<div id='other' style="display: none">
<input type='text' placeholder="FILL IN"/><br/>
<select id='pets' onChange='check()'>
<option value='DOG'>DOG</option>
<option value='RABBIT'>RABBIT</option>
<option value='OTHERS'>OTHERS</option>
</select>
<div id='besides' style="display: none">
<input type='text' placeholder="FILL IN"/>
<input type="submit" name="SUBMIT" />
</div>
</body>
</html>