From 244f27b7d251553492372bd759741c571e21c3b7 Mon Sep 17 00:00:00 2001 From: Milad Date: Thu, 9 Mar 2017 23:56:19 +0330 Subject: [PATCH] isHexColor.js In this additional file we check is input value is hex formate color --- src/additional/ishexcolor.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/additional/ishexcolor.js diff --git a/src/additional/ishexcolor.js b/src/additional/ishexcolor.js new file mode 100644 index 000000000..d84dd0891 --- /dev/null +++ b/src/additional/ishexcolor.js @@ -0,0 +1,3 @@ +$.validator.addMethod( "ishexcolor", function( value, element ) { + return this.optional( element ) || /^#(?:[0-9a-f]{6}|[0-9a-f]{3})$/i.test( value ); +}, "This is not hex format color" );