Javascript html输入框消失
我有这个简单的html表单。具有3个收音机盒选项。 最后一个广播框选项是“其他” 我希望文本框输入其他原因,仅当选择“其他”组合框时才会显示。有办法吗Javascript html输入框消失,javascript,html,twitter-bootstrap-3,Javascript,Html,Twitter Bootstrap 3,我有这个简单的html表单。具有3个收音机盒选项。 最后一个广播框选项是“其他” 我希望文本框输入其他原因,仅当选择“其他”组合框时才会显示。有办法吗 <html> <body> <div class="form-group"> <input type="radio" name="option" value="a"> Missing deadline.<br> <input type=
<html>
<body>
<div class="form-group">
<input type="radio" name="option" value="a"> Missing deadline.<br>
<input type="radio" name="option" value="b"> Unsatisfied with the work.<br>
<input type="radio" name="option" value="c"> No response from Accountant.<br>
<input type="radio" name="option" value="d"> Other reasons. <br>
<input autofocus type="text" id="reason" name="reason" placeholder="Please key in the reasons.">
</div>
<body>
</html>
错过截止日期。
对工作不满意。
会计没有回应。
其他原因
试试看
函数showTextbox(){
document.getElementById(“原因”).style.display=“块”;
}
错过截止日期。
对工作不满意。
会计没有回应。
其他原因
下面是一个使用jQuery的解决方案,通过在复选框中设置on change事件:
$(“#测试”).change(函数(){
$(“#隐藏”).show()
});代码>
#隐藏{显示:无}
点击我
alec
jQuery还是纯javascript?“纯”javascript涉及许多不属于javascript编程语言的API:)