JQuery Validation Library (Document! X Sample)
jQuery.validator Namespace / options type / focusInvalid Option
In This Topic
    focusInvalid Option
    In This Topic
    Focus the last active or first invalid element on submit via validator.focusInvalid(). The last active element is the one that had focus when the form was submitted, avoiding to steal its focus. If there was no element focused, the first one in the form gets it, unless this option is turned off.
    var options; // Type:  jQuery.validator.options
    var instance; // Type:  jQuery.validator
    instance = $(".selector").validate(options);
    var value; // Type:  boolean
    // Get value
    value = instance.focusInvalid;
    // Set value
    instance.focusInvalid = value;
    var focusInvalid : boolean;
    Browser Compatibility
    See Also