I have the following code (i am using the following bootstrap datepicker : /)
The datepicker must be closed when you click on a day. (not the changedate event because a moth of year can also be changed)
everything works fine for just one time. The function is just firing once.
Also I want to retrieve the date from the datepicker
How can you achieve this
(function () {
var setDate = $('_Date').val();
//$('#_datepicker').datepicker('setValue', now);
$('#_datepicker').datepicker('setValue', setDate);
$('#_Date').change(function () {
setDate = $('#_Date').val();
$('#_datepicker').datepicker('setValue', setDate);
console.log('day2');
});
})(jQuery)
$(function () {
$('.datepicker-days td.day').click(function (e) {
e.preventDefault();
console.log('day');
//$('#_datepicker').datepicker('hide');
//alert($('#_datepicker').getDate());
//return false;
});
});
HTML / ASPX:
<div class="col-sm-2" runat="server" id="block_date">
<div class="input-group input-append date" id="datepicker_addcase" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
<asp:TextBox runat="server" ID="cn_Date" CssClass="form-control" type="date-local" placeholder="Date" Text="Date"></asp:TextBox>
<div class="input-group-addon">
<span class="glyphicon glyphicon-calendar add-on"></span>
</div>
</div>
</div>
I have the following code (i am using the following bootstrap datepicker : http://www.eyecon.ro/bootstrap-datepicker/)
The datepicker must be closed when you click on a day. (not the changedate event because a moth of year can also be changed)
everything works fine for just one time. The function is just firing once.
Also I want to retrieve the date from the datepicker
How can you achieve this
(function () {
var setDate = $('_Date').val();
//$('#_datepicker').datepicker('setValue', now);
$('#_datepicker').datepicker('setValue', setDate);
$('#_Date').change(function () {
setDate = $('#_Date').val();
$('#_datepicker').datepicker('setValue', setDate);
console.log('day2');
});
})(jQuery)
$(function () {
$('.datepicker-days td.day').click(function (e) {
e.preventDefault();
console.log('day');
//$('#_datepicker').datepicker('hide');
//alert($('#_datepicker').getDate());
//return false;
});
});
HTML / ASPX:
<div class="col-sm-2" runat="server" id="block_date">
<div class="input-group input-append date" id="datepicker_addcase" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
<asp:TextBox runat="server" ID="cn_Date" CssClass="form-control" type="date-local" placeholder="Date" Text="Date"></asp:TextBox>
<div class="input-group-addon">
<span class="glyphicon glyphicon-calendar add-on"></span>
</div>
</div>
</div>
Share
Improve this question
asked Jan 22, 2015 at 10:25
kishen Biekhramkishen Biekhram
631 silver badge6 bronze badges
2 Answers
Reset to default 3 $('.datepicker-days').on('click', 'td.day', function (e) {
e.preventDefault();
$('#datepicker_addcase').datepicker('hide');
return false;
});
remove first b.stopPropagation() in "bootstrap-datepicker,min.js" and try:
$(document).on('click','td.day:not(\'.disabled\'):not(\'.active\')',function(e){
// MY LOGIC
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745583496a4634392.html
评论列表(0条)