javascript - If field empty set border to red -


after click on button set border around text field red.

name <input type="text" class="one" id="name">  <input type="button" value="ok" > 

i know style border

.one { border-style:solid; border-color:#0000ff; } 

i want set border red if field name empty after click on button. can make php or must use java script , event on click ??

you have use javascript that. should call javascript function upon click text box , add class when button clicked hence applying css when class added javascript. have in function check if text box empty add class else skip.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -