简体   繁体   中英

Bootstrap datepicker clone not working

I use simple datepicker for twitter bootstrap http://bootstrap-datepicker.readthedocs.io/en/latest/

Try to clone input tag and append into another div. First input tag datepicker works perfectly. But second one(cloned input tag) isn't working at all.

I tried with this code

<div class="first">
  <input type="text" class="form-control sandbox-container">
</div>

<br>

<div class="second">
</div>

$('.sandbox-container').datepicker({
});

$( ".sandbox-container" ).clone().appendTo( ".second" );

Here is the jsfiddle

Any solution?

add .datepicker as well to your clone.

$( ".sandbox-container" ).clone().appendTo( ".second" ).datepicker({
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM