Button Click Example

Creates an input button and assigns a click event to it.

by youssef moudine

HTML

<input type="datetime-local" id="date">
<input type="button" id="button" value="Click Me" />

<input type="text" id="output">
<input type="text" id="output_">

JavaScript

$('#button').click(function() {
    $("#output").val(new Date($("#date").val()).getTime());
    $("#output_").val(new Date($("#date").val()));
});