Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date picker doesn't take options if called with M.Datepicker.init #6040

Open
optyler opened this issue Jul 20, 2018 · 0 comments
Open

Date picker doesn't take options if called with M.Datepicker.init #6040

optyler opened this issue Jul 20, 2018 · 0 comments

Comments

@optyler
Copy link

optyler commented Jul 20, 2018

When you try to init the date picker programmatically, you should use the jQuery version. Vanilla one does not take care of options.

const options = {
  autoClose : true,
};

// BROKEN: date picker correctly bind, BUT options are not take
document.addEventListener('DOMContentLoaded', function() {
  const elems = document.querySelectorAll('.datepicker');
  const instances = M.Datepicker.init(elems, options);
});

// WORKING : date picker correctly bind, AND options are correctly take
$(document).ready(function(){
  $('.datepicker').datepicker(options);
});
  • Version used: 1.0.0.rc2
  • Browser Name and version: latest Chrome
  • Operating System and version (desktop or mobile): osx, ubuntu, windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant