Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:1103051
Created Jul 24, 2011

What would you like to do?
3.8.1 Customizing the validation messages
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
function addCustomValidation() {
var fldName = document.getElementById('fullname');
fldName.form.onsubmit = function () {
if (!fldName.validity.valid) {
fldName.setCustomValidity("Nameless ones are not allowedto take part");
<body onload="javascript:addCustomValidation();">
<label>Full name: <input id="fullname" /></label> <br/>
<input type="submit" value="Enviar">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment