JQuery UI datepicker not working when bound to a class

后端 未结 2 2235
野趣味
野趣味 2021-02-19 13:24

I\'ve got this code:



     
  

        
相关标签:
2条回答
  • 2021-02-19 13:43

    Please check if the datepicker works if you change the class name of the input fields from 'hasDatePicker' to something else. The reason is, when add the datepicker to the input field using the below code:

    $(function() {
      $('#date').datepicker();
    });
    

    it adds the class name "hasDatePicker" to the input field. (which is the one u r using)

    0 讨论(0)
  • 2021-02-19 14:06

    Don't use hasDatepicker as your date picker's class name. Use a different name, like date_picker.

    JQuery adds the class hasDatepicker to the element that datepicker() is called on. If the element already has the class hasDatepicker, then the datepicker() function does nothing. So, just use a different class name.

    0 讨论(0)
提交回复
热议问题