Answer the question
In order to leave comments, you need to log in
How to correctly assign the type of variables (events and html element)?
There is a code that works, but the IDE swears:
export function verifyRequired (event: { target: HTMLInputElement }, ignoreError: boolean = false) {
updateStepButton(ignoreError)
const currentElement: HTMLInputElement = event.target
const parentElement = currentElement.parentNode.querySelector('span')
if (currentElement.getAttribute('required') && (!currentElement.value || currentElement.value.length < 2)) {
parentElement.classList.add('show-tooltip')
} else {
parentElement.classList.remove('show-tooltip')
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question