假设用户单击下面的字段并选择一个文件,如何完成此操作
<input type="file" name="file" id="file"/>
然后
<input type="text" name="ytube" id="ytube" value="" />
被禁用,如果您点击 pipe ,则图像选项会被禁用?
提前致谢:)
最佳答案
使用jquery
$(function() {
$("input:file").change(function (){
$("#ytube").prop('disabled', true);
});
$("#ytube").change(function (){
if($("#ytube").val().trim() != ""){
$("#file").prop('disabled', true);
}else{
$("#file").prop('disabled', false);
}
});
});
关于javascript - 如果选择了另一个输入字段,则禁用该输入字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35891107/