0

How can I write this code:

$(function()
{ 
$('#datetime').datepicker({duration: '',showTime: true,constrainInput: false});
});

in JavaScript onclick?

2 Answers 2

4
$('#myBtn').click(function(){
$('#datetime').datepicker({duration: '',showTime: true,constrainInput: false});
})
Sign up to request clarification or add additional context in comments.

1 Comment

Awesome; you beat me to it by 5 seconds!
1
$("#youdbuttonid").bind("click", function(){
      $('#datetime').datepicker({duration: '',showTime: true,constrainInput: false});
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.