isFilled (form element) Function


/ Published in: JavaScript
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments


You need to login to view comments.