1

I'm using datepicker bootstrap 3. I want to fire another event when I select a date.

My code:

$('td.day').click(function(){
    alert("It's Not work")
})
<tr>
    <td class="day">8</td>
    <td class="day">9</td>
    <td class="day">10</td>
    <td class="day">11</td>
    <td class="day">12</td>
    <td class="disabled day">13</td>
    <td class="disabled day">14</td>
</tr>

a demo JSFiddle

1
  • @RoryMcCrossan. Oh ok. Dint get that.
    – Zee
    Jun 3, 2015 at 9:40

2 Answers 2

4

Bootstrap datepicker raises a changeDate event when a selection is made. You can use on to hook to that:

$('.datepicker').datepicker({
    startDate: "auto",
    todayHighlight: true
}).on('changeDate', function() {
    alert($(this).val());
});

Updated fiddle

1
1

You should use the changeDate event.

$(".datepicker").on("changeDate", function(event) {
     alert("test");
});

DEMO

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.