var colorbox = document.getElementById('TestColor1'); colorbox.setAttribute('type', 'color'); colorbox.className = &quot;cTextbox&quot;;
For browser availability, it may serve to make the TextBox a bit larger. When it renders in IE, at least the end user will be able to input a color hex value.
On the output path, the data from the color picker resolves as a hex value regardless of the type rendered. For example, selecting the color “Red” from the color picker will result in the value of that TextBox being a string value “#ff0000”.
More information on input types and browser compatibility can be found here.