Datepicker returning uncaught typeError: undefined 'currentDay'

后端 未结 8 1457
有刺的猬
有刺的猬 2020-12-09 14:28

I\'ve been using jQuery UI with Bootstrap and I seem to run into a problem that I haven\'t had before. I\'m not sure what has changed; I\'ve tried setting back different ver

相关标签:
8条回答
  • 2020-12-09 14:55

    I've ran into this problem too, and i was 100% sure i did not use duplicate id. After some debugging i found out a reason - i was using DataTables mod, which duplicates contents of tfoot, thus creating exact copy of datepicker elements. And i had this datepicker inputs in tfoot row.

    Fixed that issue with:

    table.find("TFOOT").find("TR:first").remove();
    

    Which is called AFTER table.DataTable(....)

    This removed original, zero height row with all contents;

    0 讨论(0)
  • 2020-12-09 15:03

    I've found the solution. After a long time of debugging I figured out that there was a <div> that had the exact same ID, lying higher than the input field. Therefore the script took the first instance that contained the ID and picked the DIV instead of the input field.

    I removed/renamed the DIV and it worked fine again.

    0 讨论(0)
  • 2020-12-09 15:09

    I was having this error also. I found that elsewhere on the form I had some label 'for' attributes that did not match ids on the form inputs - seems like this might confuse datepicker too. Once I fixed those up, everything worked fine and the error went away. Take Andreas' advice (+1 for that!) and validate your forms - Chris Pederick's Web Developer Toolbar gives you an easy way to validate as you go.

    0 讨论(0)
  • 2020-12-09 15:10

    The above jQuery datepicker error is generally caused by having a duplicate controls with the same ID, no matter whether you use id or another selector like css class or field name to instantiate it.

    0 讨论(0)
  • 2020-12-09 15:12

    I solved this with create new ID for HTML DOM object. There is duplicated Id. Try to add new ID for HTML DOM object.

    0 讨论(0)
  • 2020-12-09 15:15

    In my case I was triggering the datepicker from a div against a hidden input field and getPos(a) was causing an undefined message on the variable "a". I experimented with moving the hidden input field outside of a div and that did the trick. Note that the input field was findable by jQuery no matter where it was, so that was not the problem - it was with positioning. Hope this helps someone else.

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