Validate Form Fields using jQuery
function validateField(element, e){ var restriction = element.attr(‘data-restriction’); var errorText = element.attr(‘data-error-text’); var required = element.attr(‘data-required’); var name = element.attr(‘name’); var label = element.siblings(‘label’).html(); var tagName = element.prop(‘tagName’).toLowerCase(); var value = element.val(); if (typeof restriction !== ‘undefined’){ if (restriction == ‘numeric’){ if (typeof e !== ‘undefined’){ // Allow: backspace, delete, tab, escape, enter and . if […]
Read more