Skip to content

Instantly share code, notes, and snippets.

@veryrobert
Created April 25, 2014 10:19
Show Gist options
  • Save veryrobert/11284628 to your computer and use it in GitHub Desktop.
Save veryrobert/11284628 to your computer and use it in GitHub Desktop.

Revisions

  1. Robert Farrelly created this gist Apr 25, 2014.
    13 changes: 13 additions & 0 deletions formValidate
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    // <form id="myForm" name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post" class="form" novalidate>

    function validateForm()
    {
    var x=document.forms["myForm"]["fname"].value;
    if (x==null || x=="")
    {
    $('input.required').addClass('warning');
    $('input.required').after('<p class="warning four-eight">Form field entered incorrectly please try again</p>');
    return false;
    }
    }