2017-02-21 106 views
0

我正在使用jQuery Validetta表單驗證。我注意到,在日期選擇器上,驗證僅在第二次運行。在這裏嘗試了很多代碼,但似乎沒有工作。該FF是:jQuery Validetta datepicker只能第二次使用

日期選擇器代碼:

$('#datepicker').datepicker({ 
    dateFormat: 'yy-mm-dd', 
    changeMonth: true, 
    changeYear: true, 
}); 

測試代碼:

$("#datepicker").datepicker({ 
    onClose: function() { 
     $('#myForm').validetta(); 
    } 
}); 

$("#datepicker").on('keyup blur', function() { 
    $('#myForm').validetta(); 
}); 

請幫助。

回答

0

檢查此Fiddle link。 但我的疑問是,爲什麼你要初始化validetta datepicker.It的onClose將工作由違約金fiddle初始化

$("#datepicker").datepicker({ 
    dateFormat: 'yy-mm-dd', 
    changeMonth: true, 
    changeYear: true, 
    onClose: function() { 
    $('form').validetta({ 
     realTime: true, 
     bubblePosition: 'bottom', 
     realTime: true 
    }); 
    } 
}); 
相關問題