0

I want to validate that the inputted data, contains a phrase, such as '%TAG%'. So, if %TAG% is not present within the text, it doesn't validate.

Any ideas how I can do this using the jQuery validation plugin? Thanks!

1 Answer 1

1

First Add a method to the validator

$.validator.addMethod("checkTAGPhrase", function(value, element) {
    return (/%TAG%/.test(value));
}, "Invalid.");

Next use this validation class on your input element

<input type="text" name="myInput" class="checkTAGPhrase">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.