How to Bind and unbind DateTimepicker on Button click


This Content is from Stack Overflow. Question asked by Greesh

The Date time picker bind and it’s working fine, but when user click on refreshTime button then always it should open refresh time.
Currently what happen when the Datetimepicker bind then it always show the time of the selected one in which user change now current time.
So is there any way to Bind the Datetimepicker runtime on button click . I tried but Create multiple Datetimepicker.

 <!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <link href="css/datetimepicker.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="">
    <script src=""></script>
    <script src="" integrity="sha512-LGXaggshOkD/at6PFNcp2V2unf9LzFq6LE+sChH7ceMTDP0g2kn6Vxwgg7wkPP7AAtX+lmPqPdxB47A0Nz0cMQ==" crossorigin="anonymous"></script>
    <script type="text/javascript" src="js/datetimepicker.js"></script>
        body{ background-color: beige; direction: ltr;}
    <script type="text/javascript">
    $(document).ready( function () {
        $('#picker-no-time').dateTimePicker({ showTime: false, dateFormat: 'DD/MM/YYYY', title: 'Select Date'});
    <title>Date Time Picker</title>
<div style="width: 250px; margin: 50px auto;">
    <div id="picker"></div>
    <input type="hidden" id="result" value="" />
<div style="width: 250px; margin: 50px auto;">
    <div id="picker-no-time"></div>
    <input type="hidden" id="result2" value="" />


Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?