本文实例讲述了jquery dialog获取焦点的方法。分享给大家供大家参考,具体如下:
$(document).ready(function () {
//初始化新增申请对话框
$("#addBusinessTrip").dialog({
open: function (event, ui) {
$(':input', '#addBusinessTripForm').not(':button, :submit, :reset, :hidden').val('');
$("#addBusinessTripForm").validationEngine({
inlineValidation: false,
success: false,
failure: function () {
callFailFunction();
}
});
},
focus: function (event, ui) {
comsole.log("dsfhsdj");
$("#carOrNot").focus();//修改焦点
},
close: function (event, ui) {
//清空提示信息
$('#addBusinessTripForm').validationEngine('hideAll');
},
autoOpen: false,
width: 480,
modal: true,
buttons: {
"确定": function () {
var valid = $('#addBusinessTripForm').validationEngine('validate');
if (valid == true) {
newOrEditAjax();
} else {
//alert("验证失败!!");
}
},
"取消": function () {
$(':input', '#addBusinessTripForm').not(':button, :submit, :reset, :hidden').val('').removeAttr('checked').removeAttr('selected');
$(this).dialog("close");
}
}
});
});
希望本文所述对大家jQuery程序设计有所帮助。