/Ugly/ + 'JavaScript'

A place for ugly, silly, or just-plain-crap JavaScript.

No xss please

A validation rule applied to all text inputs, politely protecting against xss attacks.

$.validator.addMethod("script", function (value, element) {
	var v = value.toLowerCase();
	if (v.indexOf("<script") >= 0 || v.indexOf("<xss") >= 0) {
		return false;
	} else {
		return true;
	}
}, "Please do not enter JavaScript into this area.");
Posted by twalker on 18 Sep 2011 | linky

Subscribe or follow @UglyJS!
.........
Fork then send a pull request to contribute.