我試圖禁用一個html輸入標籤type="file"
,我正在使用上傳圖像。我使用無線電選項來指示是或否。如果用戶單擊否,它應該禁用輸入文本框。這是我使用的代碼,但我不知道我做錯了什麼。使用jquery禁用輸入文本框類型=文件
<html>
<head>
<title>test</title>
<script src="assets/js/jquery-1.11.1.min.js"></script>
</head>
<body>
<div class="form-group" style="">
<p> Indicate Payment Method:</p>
<input id ="inptrue" type="radio" name="pmethod" value="Yes">Yes<b>
<input id="inpfalse" type="radio" name="pmethod" value="No">No;
</div>
<div class="form-group">
<label for="file">Upload your Payment Evidence: <i>for Bank Deposit only</i></label>
<input id="images" type="text" name="file" class="form-first-name form-control">
</div>
<script type="javascript/text">
$('#inputattrib').change(function() {
$('#images').prop('disabled', false);
});
$('#inputattribf').change(function() {
$('#images').prop('disabled', true);
});
</script>
</body>
</html>
它的類型不是文件'<輸入ID = 「圖像」 類型= 「文本」' –
是什麼'#inputattrib'? – Rohit
@Mhamhammad你已經完全破壞了問題的傢伙。 –