Skip to content

Instantly share code, notes, and snippets.

@jhpowell82
Created April 20, 2012 20:51
Show Gist options
  • Save jhpowell82/2431822 to your computer and use it in GitHub Desktop.
Save jhpowell82/2431822 to your computer and use it in GitHub Desktop.
Gist jsFiddle Test
input.required { background-color: #EDA }
label { width: 10em; float: left; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
<form method="post" id="contactForm">
<table>
<tr>
<td><label for="txtName">Name:</label></td><td><input type="text" class="required" name="txtName" id="txtName"/></td>
</tr>
<tr>
<td><label for="txtEmail">Email:</label></td><td><input type="text" class="required email" name="txtEmail" id="txtEmail"/></td>
</tr>
<tr>
<td>Phone Number:</td><td><input type="text" title="Phone" name="txtPhone" id="txtPhone"/></td>
</tr>
<tr>
<td colspan="2">Preferred contact method:</td>
</tr>
<tr>
<td colspan="2">
<input type="radio" name="radioContactMethod" id="radioContactMethod" value="E" checked="checked" />Email
<input type="radio" name="radioContactMethod" id="radioContactMethod" value="P" disabled />Phone
</td>
</tr>
<tr>
<td colspan="2">
Notes:
</td>
</tr>
<tr>
<td colspan="2">
<textarea name="txtNotes"></textarea>
</td>
</tr>
<tr>
<td><button onClick="$('#contactForm').validate();">Submit</button></td>
</tr>
</table>
</form>
$(document).ready(function(){
$("#contactForm").validate();
});
name: Demo
description: Demo
authors:
- Jonathan Powell
resources:
- http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js
normalize_css: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment