diff --git a/src/core.js b/src/core.js index 93fe25568..b32519893 100644 --- a/src/core.js +++ b/src/core.js @@ -1248,6 +1248,12 @@ $.extend( $.validator, { for ( method in $.validator.methods ) { value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() ); + + // Cast empty attributes like `data-rule-required` to `true` + if ( value === "" ) { + value = true; + } + this.normalizeAttributeRule( rules, type, method, value ); } return rules; diff --git a/test/index.html b/test/index.html index 0079aa7d9..d02732856 100644 --- a/test/index.html +++ b/test/index.html @@ -277,7 +277,9 @@
- + + +