Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/411.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript html输入框消失_Javascript_Html_Twitter Bootstrap 3 - Fatal编程技术网

Javascript html输入框消失

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表单。具有3个收音机盒选项。 最后一个广播框选项是“其他” 我希望文本框输入其他原因,仅当选择“其他”组合框时才会显示。有办法吗

<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:)