Skip to content

Instantly share code, notes, and snippets.

@dustinpoissant
Last active December 20, 2017 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustinpoissant/22ce25c9e536bb2c5a2a363601ba261c to your computer and use it in GitHub Desktop.
Save dustinpoissant/22ce25c9e536bb2c5a2a363601ba261c to your computer and use it in GitHub Desktop.
A function to check if a string color is valid.
function validColor(color){
if(color=="")return false;
var $div = $("<div>");
$div.css("border", "1px solid "+color);
return ($div.css("border-color")!="")
}
function validColor(a){if(""==a)return!1;var b=$("<div>");return b.css("border","1px solid "+a),""!=b.css("border-color")}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment