guards.js

View the Project on GitHub on-site/guards.js

jQuery Methods

guard

signature: selected.guard()

available since: 1.0.0

Clear any guard errors present on the form fields within the selected form (or other containing element around form elements), and then test each element in order against each guard in the order the guards were defined. If any of the fields had an error, focus the first such field.

As of version 1.5.1, directly selected form fields will be guarded as well. The order of evaluating selected fields is undefined, as it is dependent on jQuery.

clearErrors

signature: selected.clearErrors()

available since: 1.0.0

Clear any guard errors on the selected elements.

:has-error

signature: jQuery("selector:has-error")

available since: 1.0.0

This is a jQuery selector that can be used to select elements that currently have an error.