...

View Full Version : Check color hex code with Javascript



guvenck
06-15-2007, 04:53 PM
Hello,

How can I validate a form field if the visitor has entered a valid hex color code between #000000 and #FFFFFF?

Thanks in advance.

Philip M
06-15-2007, 05:01 PM
if (/^(#[A-F0-9]{6})$/i.test(lstr.value)) { // valid hex code

You can test your regular expressions at: http://www.ogauge.co.uk/regextester.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum