~ overflow ~

JQuery validator method for twitter

by z3n on Jul.07, 2010, under Coding, Tips & Hints

Problem:

How to validate twitter @your_crap_name using jQuery’s validator plugin?

Solution:

jQuery.validator.addMethod("twitter", function(twitter, element) {
	return this.optional(element) || twitter.match(/^@+\b[A-Z0-9._%-]+\b/i);
}, "Twitter inválido");
:, , ,


No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!