1
<label for="desktop_dimension_id">Desktop dimensions:</label>
<span class="checkbox" id="desktopCheckboxId">
<span class="checkbox_value">
<input id="dc1280_800" type="checkbox" name="1280x800"> 1280x800</span>
<input id="db1280_800" class="desktop_disabled" type="file" name="desktop_path_1280x800" size="100" />
<span class="checkbox_value">
<input id="dc1366_768" type="checkbox" name="1366x768"> 1366x768</span>
<input id="db1366_768" class="desktop_disabled" type="file" name="desktop_path_1366x768" size="100" />
<span class="checkbox_value">
<input id="dc1920_1080" type="checkbox" name="1920x1080"> 1920x1080</span>
<input id="db1920_1080" class="desktop_disabled" type="file" name="desktop_path_1920x1080" size="100" />
</span>
<input id="desktopCheckbox" type="checkbox" name="type[]" value="1">Desktop
JAVASCRIPT
$(document).ready(function() {
var selected = $('#desktopCheckboxId input[type=file]');
selected.change(function(){
$('#desktopCheckbox').prop('checked', true);
});
});
以上就是如果有任何文件被選擇/上傳,檢查桌面複選框的代碼。但問題是我想在沒有選擇文件時從複選框中刪除檢查。
很酷!非常感謝@superscript! – vephelp
需要等待幾分鐘,然後我才能接受它。 – vephelp