skip to Main Content

Dynamic Input Color

Ever had the need to highlight your <input>’s by coloring the border and/or placing initial values with initial colors? Well here is a very simple way of doing it in just one line..

<input style=”color: #f00″ type=”text” value=”Your email” onblur=”if(this.value == ”) {’#f00′; this.value=’Your email’}” onfocus=”if (this.value == ‘Your email’) {’#0f0′; this.value=”}”>

Source :


Editorial Staff at ETN Multimedia is led by Alphonse Tan. Page maintained by Alphonse Tan

Back To Top