Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/467.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 如何将无线电输入与文本输入相结合_Javascript_Html_Css_Forms_Radio Button - Fatal编程技术网

Javascript 如何将无线电输入与文本输入相结合

Javascript 如何将无线电输入与文本输入相结合,javascript,html,css,forms,radio-button,Javascript,Html,Css,Forms,Radio Button,我正在尝试为表单中的“其他”字段构建一个组合的无线电/文本输入 <input id="artist" type="radio" name="artist" value="Other"> <input id="other-artist" type="text" name="other_artist" placeholder="Other Artist"/> 我不知道如何在文本输入中单击并选择收音机。我尝试将文本输入包装到标签中,但没有成功。您可以添加一个onclick

我正在尝试为表单中的“其他”字段构建一个组合的无线电/文本输入

<input id="artist" type="radio" name="artist" value="Other">
<input id="other-artist" type="text" name="other_artist" placeholder="Other Artist"/>


我不知道如何在文本输入中单击并选择收音机。我尝试将文本输入包装到标签中,但没有成功。

您可以添加一个onclick事件来取消输入,然后像这样检查收音机

<input id="artist" type="radio" name="artist" value="Other">

<input id="other-artist" type="text" name="other_artist"placeholder="Other Artist" 
onClick="selectRadio()" />


希望有此帮助。

您可以添加一个onclick事件来取消输入并像这样检查收音机

<input id="artist" type="radio" name="artist" value="Other">

<input id="other-artist" type="text" name="other_artist"placeholder="Other Artist" 
onClick="selectRadio()" />


希望对您有所帮助。

您的要求不明确。您希望通过单击文本框来选中
收音机
。那么,如果稍后需要,您如何再次取消选中
收音机
?您的要求不清楚。您希望通过单击文本框来选中
收音机
。那么,如果稍后需要,您如何再次取消选中
收音机