]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
docs: fix example for custom validator
authorOlena Pastushenko <pastushenko.olena@gmail.com>
Sat, 10 Mar 2018 09:35:57 +0000 (10:35 +0100)
committerOlena Pastushenko <pastushenko.olena@gmail.com>
Sat, 10 Mar 2018 19:32:01 +0000 (20:32 +0100)
Foundation initialization was misplaced in the example, hence it was confusing. Discussed in #9773.

docs/pages/abide.md

index 2c4bf8e9c98c1d68f7b0e2f9ccfeb51a0164d771..92442c0d0aba71a0d2381883843e318e72571d85 100644 (file)
@@ -350,9 +350,6 @@ website: {
 Foundation.Abide.defaults.patterns['dashes_only'] = /^[0-9-]*$/;
 Foundation.Abide.defaults.validators['greater_than'] =
 
-// Init Foundation
-$(document).foundation();
-
 function($el,required,parent) {
   // parameter 1 is jQuery selector
   if (!required) return true;
@@ -360,6 +357,10 @@ function($el,required,parent) {
       to = $el.val();
   return (parseInt(to) > parseInt(from));
 };
+
+// Init Foundation
+$(document).foundation();
+
 ```
 ```html
 <input id="phone" type="text" pattern="dashes_only" required >