Problem with DataPicker and JavaScript

0
$(document).ready(function(){
    var id;
    $(".cell").dblclick(function(e){
        id = e.target.id;
        $('#ModalReserva').modal('toggle'); 
        $('#datetimepicker1').datetimepicker({date: id});

    });
});

I have several cells in a table, with class cell . I want that when I double-click, my modal form will open. (up there well), but in the modal form I have a datapicker .

I need that datapicker to be set with the content of id of the cell that was clicked, all the cells of my table have as id an exact date as 10-12-2018 for example.

When I put $('#datetimepicker1').Datetimepicker({date: id}); it does not work for me, but if I do $('#datetimepicker1').Datetimepicker({date: '10-10-2018'}); then it works correctly.

Does anyone know what happens?

    
asked by Sergio Cristiá 05.11.2018 в 18:06
source

0 answers