在这个Jquery函数中,我想启用一个浏览按钮,但我无法做到。
按钮ID为ctl00_ContentPlaceHolder1_fupSendNewDocument
<script language="javascript" type="text/javascript">
function pageLoad() {
$(function () {
/********************************************Open and close model window for File Upload*********************************/
$('#divAttach').click(
function () {
var filedivcount = $('div').filter('#MultiFilelabel1').length;
var $btn = $('#divAttach');
var count = ($btn.data("click_count") || 0) + 1;
$btn.data("click_count", count);
$("#ctl00_ContentPlaceHolder1_fupSendNewDocument").attr("disabled", false);
if ($('input').filter('#ctl00_ContentPlaceHolder1_fupSendNewDocument_F1').length > 0) {
if (count < 3 || filedivcount < 3) {
document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument_F1').click();
} else {
alert('you can upload only 3 files');
}
}
if ($('input').filter('#ctl00_ContentPlaceHolder1_fupSendNewDocument_F4').length > 0) {
if (count < 3 || filedivcount < 3) {
document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument_F4').click();
} else {
alert('you can upload only 3 files');
}
} else {
if (count < 3 || filedivcount < 3) {
document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument').click();
} else {
alert('you can upload only 3 files');
}
}
}
);
});
}
</script>
答案 0 :(得分:1)
大多数浏览器不关心disabled属性的值。如果它在那里它将被禁用。 http://www.w3schools.com/tags/att_input_disabled.asp
因此您需要删除属性:
$("#ctl00_ContentPlaceHolder1_fupSendNewDocument").removeAttr("disabled");