gpt4 book ai didi

javascript - jQuery blockUI 不工作

转载 作者:行者123 更新时间:2023-12-01 02:10:34 25 4
gpt4 key购买 nike

我正在尝试使用 blockUI,但虽然它没有错误地通过,但它不起作用

下面的代码全部在 $(document).ready() 函数中

$("#btnSaveJob").click(function () {

if ($("#frmJobDetails").valid()) {
$("#frmJobDetails").submit();
}

});

$("#frmJobDetails").submit(function (e) {

$('#jobDetails').block({
message: 'Saving, please wait...',
centerX: true,
centerY: true,
css: {
width: '600px',
height: '300px',
border: '3px solid #FF9900',
backgroundColor: '#000',
color: '#fff',
padding: '25px'
}
});

submitNew('job');
e.preventDefault();

$('#jobDetails').unblock();
});

编辑添加到submitNew函数

function submitNew(submitType) {


// various variables set here

if (submitType == 'job') {
PageMethods.SubmitJobForm(propID, dateReceived,
targetResponse, targetComplete, chargeable, jobTypeID,
jobTypeText, contractID, contractText, csJobTypeID,
csJobTypeText, priorityID, priorityText, status, notes,
fnsuccesscallbackJob, fnerrorcallback);
}
else if (submitType == 'instruction') {
PageMethods.SubmitInstruction(fnsuccesscallbackInstruction,
fnerrorcallback);

}
else {

}

}

必须在编辑器中添加这一点,提示我添加了太多代码......

最佳答案

试试这个:

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.66.0-2013.10.09/jquery.blockUI.js">
</script>

<script>
$(document).ready(function() {

$('#btnSubmit').on('click', function() {

$('#form').validate({
errorPlacement : function(error, element) {
error.insertBefore(element); // <- the default
},

rules : {
username : {
required : true
},
password : {
required : true,
},
},
messages : {
username : {
required : " Username required."
},
password : {
required : " Password required."
},
},

});
if($('#form').valid()){
$.blockUI({ message: 'Just a moment...</h1>' });
}
});

});
</script>

关于javascript - jQuery blockUI 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29796115/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com