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 -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -