Skip to content

Commit

Permalink
Create a new instance of Malle for each elements #8
Browse files Browse the repository at this point in the history
This allows opening multiple inputs at the same time. fix #4
  • Loading branch information
NicolasCARPi authored Jun 14, 2023
1 parent bfe4ac1 commit e7d2b11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ export class Malle {
listen() {
document.querySelectorAll(this.opt.listenOn)
.forEach((el: HTMLElement) => {
el.addEventListener(this.opt.event, this.process.bind(this));
const opt = this.opt;
opt.listenNow = false;
const m = new Malle(opt);
el.addEventListener(this.opt.event, m.process.bind(m));
// make the mouse change to pointer on targeted elements
el.style.cursor = 'pointer';
if (this.opt.tooltip) {
Expand Down

0 comments on commit e7d2b11

Please sign in to comment.