我有四个字段,其中两个是文本输入字段,另一个是单选按钮。问题是,我希望文本字段被启用时,只有选择相应的单选按钮。
我尝试在单选标记中使用onclick和oncheck函数,但它对启用文本框有效,但禁用无效
<html>
<body>
<input type="radio" name="type" value="customurl" onclick="document.getElementById('text').removeAttribute('disabled')">
<input type="text" id="text" name="custom1" placeholder="should be 5 charecters at least" disabled>
<input type="radio" name="type" value="customurl" onclick="document.getElementById('sel').removeAttribute('disabled')">
<input type="text" id="sel" name="custom2" placeholder="should be 5 charecters at least" disabled>
</body>
</html>
如果我选择radio1 textbox1 is enabled,当选择单选时,textbox2 enabled但textbox1 not disabled
https://stackoverflow.com/questions/56761768
复制相似问题