jQuery Validation addMethod - Check if same domain -
I am trying to check if the URL belongs to the same domain, which is the validation of the jQuery Edemath.
Even what I have achieved so far, but it does not seem to:
jQuery.validator.addMethod ("domain", function ( Value, element) {return.optional (element) || /^http:\/\/testsite.com/.test(value);}, "URL is not match."); Validate $ ("# Url_form") ({Rule: {url: {required: true, url: true, domain: true}}});
understood. There may be a better way of doing this, but it worked for me:
jQuery.validator.addMethod ("domain", function (value, element) {return.optional (element )} /^(http:\/\/www..https:\/\/www\.|http:\/\/|https:\/\/)testsite.com/.test(value);}, "URL must be on the same site domain");
Comments
Post a Comment