jQuery Datepicker for multiple inputs

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

I have a jQuery datepicker script:

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


        
8条回答
  •  花落未央
    2021-01-04 16:56

    Just change all id to class.

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

    also can use

    $(function() {
      $( "input[name^=MyDate]" ).datepicker({ dateFormat: "yyyy-mm-dd" });
    });
    

提交回复
热议问题