i'm using http://www.eyecon.ro/bootstrap-datepicker date picker in form in conjunction twitter bootstrap, , i'm having trouble getting auto close, , month/year combination greater current month/year selectable. i've gone on , on documentation, can't see it. assistance appreciated.
my form below
<div class="control-group"> <label class="control-label" for="cc_cardexpiry"><strong>card expiry month/year</strong></label> <div class="controls"> <div class="input-append date datepicker" id="cc_cardexpiry" data-date="01/2014" data-date-format="mm/yyyy" data-date-viewmode="years" data-date-minviewmode="months"> <input class="span6" name="cc_cardexpiry" size="20" type="text" value="01/2015" readonly> <span class="add-on"><i class="icon-calendar"></i></span> </div> </div> </div>
and javascript is
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"</script> <script src="../js/bootstrap-datepicker.js"></script> <script type="text/javascript"> $('#cc_cardexpiry').datepicker(); </script>
by default, autoclose false. have manually set in code option.
after playing datepicker, found way without touching autoclose:
i put function above call datepicker:
var popup = function(){ var d = $(this); d.datepicker('update', new date.today().tostring("mm/dd/yyyy")) .on('changedate', function(ev){ // want here d.datepicker('hide'); }); };
then call datepicker looks this:
this.$('i.icon-calendar').datepicker().on('show', popup);
i highly recommend using code found here instead of eycon version. came eycon, github repo maintained eternicode has greater following, means if find , report bug, there's greater chance fixed. i'm not saying it's easier use, there's more support.
Comments
Post a Comment