Skip to content

Commit 08dc139

Browse files
committed
Merge pull request victorjonsson#12 from robamaton/master
Optional Attribute
2 parents 7902a15 + 909b9dd commit 08dc139

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

jquery.formvalidator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@
240240
// Validate element values
241241
//
242242
$form.find('input,textarea,select').each(function() {
243+
244+
if ($(this).attr("data-optional") == 'true' && $(this).val() == '') {
245+
return true;
246+
}
247+
243248
if (!ignoreInput($(this).attr('name'), $(this).attr('type'))) {
244249

245250
// memorize border color

0 commit comments

Comments
 (0)