Clean Form Validation
Here is the complete example code (form and script). Download and include the cleanValidator.js file.
<form id="example" action="index.html" method="get">
<div>
<label>Name:</label> <input id="name" name="name" type="text" />
</div>
<div>
<label>Email:</label> <input id="email" name="email" type="text" />
</div>
<div>
<label>Number:</label> <input id="number" name="number" type="text" />
</div>
<div>
<br /><input type="submit" value="Clean Validation!" />
</div>
</form>
<script type="text/javascript">
cleanValidator.init({
formId: ‘example,
inputColors: [’#EDEDED’, ‘#FFFFFF’],
errorColors: [‘#FFFF99’, ‘#CF3339’],
isRequired: [‘name’,‘email’,‘number’],
isEmail: [‘email’],
isNumeric: [‘number’]
});
</script>
Custom colors: inputColors and errorColors
Custom validation rules: rule: [id]