How to execute a datepicker in an input I got with ajax?

0

I have a web page where in some parts I load content with ajax , in one of these parts, I load a form in which to have the focus a input , a datepicker opens.
AND The problem is that when you bring it with ajax this plugin does not open, and if you do not charge it with ajax , if it opens.

to bring the form is something similar to this.

function traigo_form()
    {
        $.ajax(
        {
            data:{enviado: true}   
            type: "POST",
            url: "localhost/miproyecto/traer_form.php",
            success: function (data)
            {
                $('#formulario').html(data);             
            }
        });

  }
    
asked by Fernando Ferretiz 12.01.2018 в 19:24
source

1 answer

4

You must instantiate the datepicker scope in the component again.

After

  

$ ('# form'). html (data);

Initialize the component

  

$ ('# tucampo'). datepicker ();

Otherwise, paste the code you have in bring_form.php to evaluate it.

    
answered by 12.01.2018 / 19:34
source