Skip to content

Commit 909b9dd

Browse files
committed
add optional attribute
1 parent 81faf34 commit 909b9dd

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
@@ -237,6 +237,11 @@
237237
// Validate element values
238238
//
239239
$form.find('input,textarea,select').each(function() {
240+
241+
if ($(this).attr("data-optional") == 'true' && $(this).val() == '') {
242+
return true;
243+
}
244+
240245
if (!ignoreInput($(this).attr('name'), $(this).attr('type'))) {
241246

242247
// memorize border color

0 commit comments

Comments
 (0)