Tuesday, 10 September 2013

Javascript validator that does not modify the DOM

Javascript validator that does not modify the DOM

I'm looking for a browser side javascript library that does input
validation without touching the UI. Most libraries seem to want to make
things red or add error messages or in some way modify the DOM. That's
probably fine most of the time, but in this case I would really rather
just have a method that lets me check fields or maybe checks them all for
me and returns which ones are not valid and why. The point is that it lets
me decide how to display error information to the user.
Something roughly like this:
check('#name').notEmpty();
check('#email').isEmail();
check('#homepage').isUrl();
I've looked at validate.js and Parsley.js but neither seem to fit the bill.

No comments:

Post a Comment