A simple function to validate a string and make sure it is a valid hex color code function isColourCode(str) { objRegExp = /^\#[0-9A-Fa-f]{6}$/ return objRegExp.test(str); }
A simple function to validate a string and make sure it is a valid hex color code function isColourCode(str) { objRegExp = /^\#[0-9A-Fa-f]{6}$/ return objRegExp.test(str); }