i got the label of errore when i excute this as i use a time picker with a form field sharepoint control so
this is my code of jquery validation
$("input[id*='ffEnTime']").focusout(function () {
if ($("input[id*='ffEnTime']").val().trim() == "") {
$("span[id*='lblEntTime']").show();
$("span[id*='lblEntTime']").text("Write Entry Time");
}
else {
$("span[id*='lblEntTime']").hide();
}
});
and the code of timepicker that i use
$(document).ready(function () {
//Start Validation at the after form loaded
$("input[id*='ffPltNo']").attr("maxlength", "4");
$("input[id*='ffIDNumber']").attr("maxlength", "10");
$("input[id*='ffEnTime']").attr("autocomplete", "off");
$("input[id*='ffEnTime']").attr("readOnly", "true");
$("input[id*='ffEnTime']").timepicker({
timeFormat: 'hh:mm p',
minTime: '06:30:00', // 11:45:00 AM,
maxHour: 24,
maxMinutes: 30,
startTime: new Date(0, 0, 0, 06, 0, 0), // 3:00:00 PM - noon
interval: 30
});
so it's look like this See pic
the errore is come because when i click on any time to choose it'll first focus out then the validation will execute finally it'll choose the time in that case i have to chose again to let the label disapper
any suggestions to replace focus out with something better?
I tried on change but doesn't work with me.
Did u try
$("input[id*='ffEnTime']").on('input',function () {
//your validation function here
})