Add this function to your JS:
function showHideOther(){
if (document.getElementById('drop_down').value == 'other') {
showOther();
} else {
hideOther();
}
}
And change your select element like this:
<select name="" id="drop_down" onchange="showHideOther();">
<option value="choose">Please choose</option>
<option value="Allure">Allure</option>
<option value="Elle">Elle</option>
<option value="In-Style">In-Style</option>
<option value="other">Other</option>
</select>
function showHideOther() {
if (document.getElementById('drop_down').value == 'other') {
showOther();
} else {
hideOther();
}
}
function showOther() {
document.getElementById('other').value = "";
document.getElementById('other').style.display = 'block';
document.getElementById('otherBR').style.display = 'block';
}
function hideOther() {
document.getElementById('other').style.display = 'none';
document.getElementById('otherBR').style.display = 'none';
}
#other {
display: none;
}
#otherBr {
display: none;
}
<select name="" id="drop_down" onchange="showHideOther();">
<option value="choose">Please choose</option>
<option value="Allure">Allure</option>
<option value="Elle">Elle</option>
<option value="In-Style">In-Style</option>
<option value="other">Other</option>
</select>
<input type="text" name="fields_where" id="other" placeholder="Other" />
<br id="otherBR" />
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…