mirror of
https://github.com/Wolvan/poll.horse.git
synced 2024-11-22 04:58:00 +01:00
Fix options not appearing
The options only appeared when at least 2 letters were typed into the input field as the event triggered before a value was set into the input field. Using `keyup` instead of `keydown` delays the event after a letter has been typed into it.
This commit is contained in:
parent
1ad2c8c1a0
commit
23445f7509
1 changed files with 2 additions and 2 deletions
|
@ -14,7 +14,7 @@
|
|||
input.placeholder = "Enter your option here";
|
||||
optionEl.appendChild(input);
|
||||
|
||||
input.addEventListener("keydown", () => {
|
||||
input.addEventListener("keyup", () => {
|
||||
if (inputList.every(el => el.value) && pollOptionsAnchor) pollOptionsAnchor.appendChild(createPollOptionInput());
|
||||
});
|
||||
inputList.push(input);
|
||||
|
@ -23,7 +23,7 @@
|
|||
}
|
||||
|
||||
pollOptionsAnchor.querySelectorAll(".poll-option input").forEach(el => {
|
||||
el.addEventListener("keydown", () => {
|
||||
el.addEventListener("keyup", () => {
|
||||
if (inputList.every(el => el.value) && pollOptionsAnchor) pollOptionsAnchor.appendChild(createPollOptionInput());
|
||||
});
|
||||
inputList.push(el);
|
||||
|
|
Loading…
Reference in a new issue