Monday, June 3, 2024
61
rated 0 times [  65] [ 4]  / answers: 1 / hits: 150430  / 10 Years ago, wed, march 5, 2014, 12:00:00

I am using bootstrap-datepicker from here: https://github.com/eternicode/bootstrap-datepicker



version: 2.3.2



I am having trouble to clear the date values of the datepicker when a button is clicked. I have checked the API but cannot find anything on clearing/resetting the datepicker. Any help is welcome


More From » twitter-bootstrap

 Answers
31

You can use jQuery to clear the value of your date input.



For exemple with a button and a text input like this :



<input type=text id=datepicker>
<button id=reset-date>Reset</button>


You can use the .val() function of jQuery.



$(#reset-date).click(function(){
$('#datepicker').val().datepicker(update);
})

[#72141] Tuesday, March 4, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nestorjarettg

Total Points: 451
Total Questions: 108
Total Answers: 108

Location: Rwanda
Member since Thu, Feb 10, 2022
2 Years ago
;