I have a drop down list which looks like this :
<span id="billet">
<select id="test">
<option value="Option1">Option1</option>
<option value="Option2">Option2</option>
</select>
</span>
And an input like this :
<input type="text" class="datepicker" />
By choosing "option1", I would like to disable week-ends from datepickers.
By choosing "option2", I would like to reactivate all the days from datepickers.
Here is my JS :
$("#billet").on('change', 'select', function() {
if($('#test').val() == 'Option1') {
$('.datepicker').datepicker({
beforeShowDay: $.datepicker.noWeekends
});
}
else {
$('.datepicker').datepicker();
}
});
Note : I use "span" to circle my select because this drop down list is created dynamically by Ajax / PHP.