收到错误“无法读取未定义的属性'top'”

时间:2019-02-26 14:11:58

标签: jquery

我知道此错误意味着我可能会对未定义的Jquery变量执行操作,但是我觉得我已经通过所有必要的步骤来避免此错误,方法是检查值是否存在并确保长度大于0。我有一个将数据提交到数据库的表单,当我单击“提交”按钮时,我在控制台上收到此错误(数据仍被发送到db)

<script type="text/javascript">

$(document).ready(function () {
    $(function () {
        $('[data-toggle="tooltip"]').tooltip()
    });
});

$(document).on('show.bs.modal', '#BSDOMAddEditEntryModal', function () {    
    if (!$('#BSDOMAddEditEntryModal').hasClass('show') && !$('#BSDOMAddEditEntryModal').hasClass('in')) {
        $(".modal-backdrop.fade.in").remove();
        $(".modal-backdrop.fade.show").remove();
    }

    $('.BSDOMInputGrpCalendarIcon').datepicker({
        format: 'mm/dd/yyyy',
        autoclose: true
    }).on('changeDate', function (e) {
        $(this).parent().find('input:text').val(e.format());
    });
});

function validateBSDOMChkBxL(source, args) {
    if ($("[id$='" + source.id + "']").siblings('div').find('table input:checkbox:checked').length > 0) {
        args.IsValid = true;
    }
    else{
        args.IsValid = false;
    }
}

function confirmDeleteReportBtn() {
    if (confirm("Are you sure you want to delete this record?") == true) {
        return true;
    } else {
        return false;
    }
}

function CheckboxErrorVal(source) {
    if ($("[id$='" + source.id + "']").find('input:checkbox:checked').length > 0) {
        $("[id$='" + source.id + "']").parent().siblings('span').css("display", "none");
    } 
    else 
    {
        $("[id$='" + source.id + "']").parent().siblings('span').css("display", "inline");
    }
}

function BSDOMFileUploadComplete() {
    //Postback is necessary for asyncfileupload
    var id = $("[id$='_DvFileUploadPanel']").attr('id');
    updateUploadStatus("success", "File Uploaded Successfully");

    __doPostBack(id, '');
}

function BSDOMFileUploadStart(sender, args) {
    var fileName = args.get_fileName();
    var fileExt = fileName.substring(fileName.lastIndexOf(".") + 1);
    if (fileExt == "xls" || fileExt == "xlsx" || fileExt == "pdf" || fileExt == "xml" || fileExt == "doc" || fileExt == "docx" || fileExt == "jpeg" || fileExt == "jpg" || fileExt == "png") {
        return true;
    }
    else {
        //To cancel the upload, throw an error, it will fire OnClientUploadError
        var err = new Error();
        err.name = "Upload Error";
        err.message = "*Only accept format in xls, xlsx, pdf, doc, docx, jpeg, jpg, png";
        throw (err);

        return false;
    }
}
function BSDOMFileUploadError(sender, args) {
        var errmsg = args.get_errorMessage();
        updateUploadStatus("error", errmsg);
    }

function updateUploadStatus(status, message) {
        var uploadstatlbl = $("span[id$='lblUploadStatus']");
        uploadstatlbl.html(message);
        if (status == "error") {
            uploadstatlbl.removeClass("BSDOMFileUploadSuccess").addClass("BSDOMFileUploadError invalidMsgCss");
        } else {
            uploadstatlbl.removeClass("BSDOMFileUploadError invalidMsgCss").addClass("BSDOMFileUploadSuccess");
        }
    }

</script>

0 个答案:

没有答案