Hi community.
I have a large side-by-side table with open ended text entry fields. The open text entry must have correct email address format. Not all fields will need text entry. When an email address is incomplete or has the wrong format, I need to find a way to highlight the field, column or row to make it easier for the respondent to find their error. This code is not working for me. Any feedback or suggestions from the community would be greatly appreciated.
Qualtrics.SurveyEngine.addOnload(function()
{
$(document).ready(function(){
$(".InputText").on("input",function(){
if ($(this).val() == "")
$(".InputText").css({backgroundColor:""});
else {
if (checkEmail($(this).val()))
$(".InputText").css({backgroundColor:""});
else
$(".InputText").css({backgroundColor:"red"});
}
})
function checkEmail(txt) {
var patt = />a-zA-Z0-9._%+-]+@-A-Za-z0-9.-]+\.ZA-Za-z]{2,3}$/;
if(patt.test(txt))
return true;
else
return false;
}
})
});