Ask A Question

Notifications

You’re not receiving notifications from this thread.

Stimulus - flatpickr

kriera asked in Javascript

Hi all i've been trying to do one thing without sucess for few days...

i want to select a date on the flatpickr and then based on that date create a table

Date selected Date selected -1day Date selected -2day Date selected -3day Date selected -4day

//controller_calendar.js

import "flatpickr/dist/themes/dark.css";
export default class extends Flatpickr {

static targets = [ "output" ] <-- want to export the selected date on the flatpickr to the view

change(selectedDates, dateStr,instance) {
console.log (dateStr) <-- this prints out the date i select on the console.
this.outputTarget.textContent = dateStr <-- this should send the dateStr to the outputTarget but doesn't work neither here or on the XX
}
XX <-- if i put it here " this.outputTarget.textContent = dateStr" dateStr doesn't have content.
}

Any idea?

thanks all!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.