Answer the question
In order to leave comments, you need to log in
How to programmatically change the input value for validation?
Hello, I'm making a complex form with some non-standard fields. An example of such a field is a combo box (id="itemsInput" and id="choicesInput"). The dropdown() function works as I need it (in the example it is greatly simplified), but there are problems when validating with the validateForm() function. More specifically, .addEventListener("input", function(){ }); reacts to changing the value of the field by pressing keys, but does not react in any way to changing the field with the dropdown() function. It is very important for me that the invalid class is removed when clicking or hovering on the dropdown list item on the fly, but I do not know how to do it correctly. We need pure JS, without plugins and frameworks. https://jsfiddle.net/q2uL3k57/74/ Here is an example on jsfiddle Thanks.
Answer the question
In order to leave comments, you need to log in
Your validation occurs on the input event, and you need to call it. https://jsfiddle.net/c0rL2g9j/
Lines 21, 25
You can rewrite set, get for value input-a
https://codesandbox.io/s/oxyxn93n6
Well, if it's completely rude, then so - https://jsfiddle.net/Lgmc3sz1/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question