我在下面的错误消息,突出显示的字段工作正常。除了现在需要不同功能的权力。目前,错误消息用红色边框突出显示该字段,并且在焦点上移除边框。但是,现在希望红色突出显示一直持续到用户点击提交的权力onclick="return formSubmit()"
我试过使用 .submit 函数(从 .focus 函数中移除取消绑定和移除焦点,但红色突出显示仍然存在。
<!--Jquery function to override JS alert with DOM layer alert message-->
function customAlert(inputID,msg){
var div = $(".errorPopup");
div.css({"display":"block"});
$("#"+inputID).addClass("CO_form_alert").parent().addClass("alertRed");
if (div.length == 0) {
div = $("<div class='errorPopup' onclick='$(this).hide();'></div>");
$("body").prepend(div);
}
div.html(msg);
$("#"+inputID).focus(function(){
$(this).unbind('focus'); // remove this handler
$(this).removeClass("CO_form_alert")
.parent().removeClass("alertRed"); // undo changes
$('.errorPopup').hide(); // hide error popup
});
}