Files
openfoodnetwork/app/webpacker/controllers/updateinput_controller.js
Jean-Baptiste Bellet 786b198f4d Create an updateinput controller
- that update the targets input value to the value stored in data attribute
 - Add tests
2021-10-06 15:06:56 +05:30

14 lines
272 B
JavaScript

import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["input"];
update(event) {
const value = event.currentTarget.dataset.updateinputValue;
this.inputTargets.forEach((t) => {
t.value = value;
});
}
}