jQuery Datepicker for multiple inputs

前端 未结 8 1757
忘了有多久
忘了有多久 2021-01-04 16:47

I have a jQuery datepicker script:

$(function() {
    $( \"#datepicker\" ).datepicker({ dateFormat: \"yyyy-mm-dd\" });         


        
8条回答
  •  悲哀的现实
    2021-01-04 17:08

    You could also add classes on the fly if input fields are dynamically generated, such as in Django templates.

    
    
    

    Get input fields using #id and add a class

    $(function() {
        $( "#datepicker1, #datepicker2" ).addClass('datepicker');
        $( ".datepicker" ).datepicker({ dateFormat: "yy-mm-dd" });
    });
    

提交回复
热议问题