Closed Buzzak closed 7 years ago
Yes, it only selects first element, this is how document.querySelector()
works. If you need to apply it to many elements you don't need to edit source, you can just select all necessary elements and initialize PickMeUp on them individually like so:
var elements = document.querySelectorAll('.datepicker');
for (var i=0; i < elements.length; ++i) {
pickmeup(elements[i], {...});
}
This is by design.
Thank you Nazar, but i fixed the source for this work. That took me 5 minutes lol.
Cause i have different calendar with different init config.
Thank you for taking your time to answer me it's appreciate.
//Set config PickMeUp pluggin birthdate calendar addEventListener('DOMContentLoaded', function () { pickmeup('.birthdate', { first_day: 0, default_date: false, hide_on_select: true, view: 'years', mode: 'single', min: '1920-01-01', max: '2020-01-01', date: '1975-01-01', format: 'Y-m-d' }); });
//Set config PickMeUp pluggin datepicker calendar
addEventListener('DOMContentLoaded', function () {
pickmeup('.datepicker',
{
first_day: 0,
default_date: false,
hide_on_select: true,
view: 'days',
mode: 'single',
format: 'Y-m-d'
});
});
De : Nazar Mokrynskyi notifications@github.com Envoyé : 9 février 2017 18:15 À : nazar-pc/PickMeUp Cc : Buzzak; Author Objet : Re: [nazar-pc/PickMeUp] Multiple input with same class (#163)
Yes, it only selects first element, this is how document.querySelector() works. If you need to apply it to many elements you don't need to edit source, you can just select all necessary elements and initialize PickMeUp on them individually like so:
var elements = document.querySelectorAll('.datepicker'); for (var i=0; i < elements.length; ++i) { pickmeup(elements[i], {...}); }
This is by design.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nazar-pc/PickMeUp/issues/163#issuecomment-278806294, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQsACVAfHE85ScwCEA9uxTis0PR6qt06ks5ra54ZgaJpZM4L8lsH.
When i have many input with the same class ex: .datepicker only the first element work. Did i miss something? I edited my local PickMeUp.js for this work. Let me know if you want the change.