Last active
December 20, 2017 09:41
-
-
Save dustinpoissant/22ce25c9e536bb2c5a2a363601ba261c to your computer and use it in GitHub Desktop.
A function to check if a string color is valid.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validColor(color){ | |
if(color=="")return false; | |
var $div = $("<div>"); | |
$div.css("border", "1px solid "+color); | |
return ($div.css("border-color")!="") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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