My code isn’t working, I’d like letters to turn green and numbers to turn red...
const inpout = document.querySelectorAll('input');
for (const type of inpout) {
type.addEventListener('input', function() {
const res = parseInt(this.value);
if (typeof res === 'number') {
this.style.color = ('red');
} else if (isNaN(res)) {
this.style.color = ('green');
} else {
this.style.color = ('green');
}
});