I'm new to JS, and I was wondering if there is a way to change the background-color depending on the value of an input field. For example, if the user types 'happy' the background color turns blue. I'm assuming JS is used for this, but I'm not sure.
Or you can add a listener for the "input" event instead of change
Benjamin Rogers
what a piece of shit
Michael Kelly
>convoluting your code with abstract bullshit Maybe I'm a professional developer who focuses on clarity and not a moron like you who prefers to stroke his ego
Asher Bailey
IE support
Tyler Reed
Agreed since it's supported in IE > 9 only. Maybe keyup event?
Noah Allen
None of the workarounds work as good as simple polling does
You're using the wrong event for this. Use something like keyup or keydown.
Jayden King
Expressivity doesn't always mean convenience :)
Liam Reed
Why would you ever do this? Might as well just make it a function.
const shit = a => b => console.log(`The ${b} ${a}`)
shit('happy')('user') [\code]
Wyatt Stewart
Your code is so badly written it hurts to read it. Try actually learning the language before you post here.
Anthony Miller
You need to define inputElement before referring to it in your JS. So, for example, add a line like: var inputElement = document.getElementById('mood');
before the rest of the JS.
Jaxon Reyes
Ok, it works. But how can I style the background-color of the entire page?
Cooper Collins
>all of those br tags
Carson Price
Just set style to `document.body` instead of that element.