Topic: PickaDate Methods

Igor Matveev pro asked 4 years ago


Hi! I did not find a way to call the pickadate on a button (using the method). Sometimes I need to force the user to select a date. I would like to be able to manage the window pickadate from javascript, like this:
..html..
<input type="text" name="date">
<button class='btn btn-success'>Add date</button>
..js..
var i = $('input[name="date"]');
i.pickadate({ ..options.. });
$('.btn').click(function(){
  i.pickadate('show'); // as in jQuery .datepicker( "show" );
  //i.click(); // do not show pickadate
  //i.focus(); // do not show pickadate
});
Can eat other ways? Thanks!  

Jakub Strebeyko staff answered 4 years ago


Hi there Igor, Yes, I'm afraid the reason why you're not finding a way of triggering datePicker on a button click is because it's self-contained, meaning the element holding the .datepicker class is responsible for both triggering the rendering process and taking in the selected date data, and so it just must be an input. Setting these two apart would require heavy manipulation of datePicker's code. With Best Regards, Kuba

Igor Matveev pro commented 4 years ago

Thanks for answer. I hope in the next versions of MBD the functionality will be replenished with such delicious methods :)

Jakub Strebeyko staff commented 4 years ago

Thanks, we'll definitely consider it.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Closed

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags