Skip to content

Commit 338025a

Browse files
committed
Reference: Add brief example for reusing existing methods in other methods
1 parent 93523b6 commit 338025a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pages/reference.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ With that in place, we can add a class customer to all customer fields and be do
6565
<input name="customer3" class="customer">
6666
</code></pre>
6767

68+
You can also reuse existing methods inside other custom methods, to reuse certain implementations. For example, if you're writing a custom method for validating email addresses inside a single field, you could call the existing email method for each email:
69+
70+
```js
71+
jQuery.validator.methods.email.call(this, email, element)
72+
```
73+
6874
# Error messages
6975
An error message displays a hint for the user about invalid elements, and what is wrong. There are three ways to provide error messages. Via the title attribute of the input element to validate, via error labels and via plugin settings (option messages).
7076

0 commit comments

Comments
 (0)