problem when cloning jQuery UI datepicker

后端 未结 12 1612
谎友^
谎友^ 2020-11-29 05:36

I have a div in which there is a datepicker. I use something like this to clone it:

mydiv = $(\'#someDiv\');

// works fine so far
mydiv.find(\'input.datefie         


        
12条回答
  •  Happy的楠姐
    2020-11-29 05:50

    Make sure your newly cloned datepicker has a different name and ID than the original. If they both have the same name, then the behavior you're describing would be normal.

    Try changing that last line to something like:

    newDiv.find('input.datefield').attr('id', 'newDatePicker').attr('name', 'newDatePicker').datepicker();
    

提交回复
热议问题