Posted By

alberomo on 08/22/11


Tagged

javascript DOM validation manual Jeremy Keith


Versions (?)

isFilled (form element) Function


 / Published in: JavaScript
 

Arguments: Element from a form. Take that element and checks if is filled. If not, returns false. If is filled, returns true. From book Dom Scripting by Jeremy Keith

  1. function isFilled(field) {
  2. if (field.value.length < 1 || field.value == field.defaultValue) {
  3. return false;
  4. } else {
  5. return true;
  6. }
  7. }

Report this snippet  

You need to login to post a comment.