using javascript validation and some jquery to show variable error messages in the DOM, and highlighting both the form label and field.
For this particular error message, I need to highlight 2 fields (email1 and email2).
Unsure how to add it to my current setup for alerts below:
customAlert ("email2",bnadd_msg_022);
simple question, how to I add email1 into the mix?
Edit:
Here is my jquery function:
function customAlert(inputID,msg){
$("li").removeClass("alertRed");
$("input").removeClass("CO_form_alert");
$("select").removeClass("CO_form_alert");
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
$('.errorPopup').hide(); // hide error popup
});
So, In this case and on one other, I need to highlight 2 fields simultaneously
I’d make use of the arguments ‘array’ in Javascript, and simply define customAlert as a function with no arguments.
Then you call it like so: