Jess McKenzie
Jess McKenzie

Reputation: 8385

Showing error off focus - Validation jQuery

How could I show my error when the user clicks out of the input box etc?

jQuery(document).ready(function() { 
    //Home Validation
    $("#quote").validate({
        rules:{
            companyName:{
                required: true,
                url: true
            }
        }
    });
etc etc

Upvotes: 0

Views: 1089

Answers (1)

000
000

Reputation: 27247

Wow this took me WAY too long to figure out.

Short answer: input type="input" should be input type="text".

Then this will work:

$("#quote").validate({
    onfocusout: function(element) {
         $(element).valid();
    },
    rules:{
        companyName:{
            required: true,
            url: true
        }
    }
});

Upvotes: 2

Related Questions