Thursday, May 10, 2012

JS action on change


1<input type="text" name="date" />
Say an input field with the name “date” had to be validated at runtime:
1document.getElementsByName("date")[0].
2                   addEventListener("change", validateDate, false);
3 
4function validateDate(){
5// Do something when the content of the 'input' element with the name 'date' is changed.
6}