Jump to content

datepicker, not work when I create it by innerHTML


nitiphone2021

Recommended Posts

I have a problem about the javascript datepicker. 

in index.html  it has startdate and enddate it's work but when i click a button, it will open new modal up

and the new modal has a date picker(I create it again as below command )

but it's not work, this datepicker name SamplingDate is not create from beginning and startdate & enddate create from begining

    var col4 = "<div class='row p-2'><div class='col'><label>Send Sampling Date:</label><div div class='input-group date'><div class='input-group-prepend'><span class='input-group-text'><i class='far fa-calendar-alt'></i></span></div><input type='text' class='form-control' data-inputmask-alias='datetime' data-inputmask-inputformat='dd/mm/yyyy' data-mask='' inputmode='numeric' id='SamplingDate'></div></div></div></div>";

     var formupdate1 = col1.concat(col2,col3,col4,col5,submit);

      document.getElementById('Updateform').innerHTML = formupdate1;

 


	Work, startdate and enddate after load page
    $('#startdate').datepicker({
      autoclose: true
    })
    $('#enddate').datepicker({
      autoclose: true
    })
   
     // not work
    $('#SamplingDate').datepicker({
      autoclose: true
    })

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.