So, the code below (it's complete in link ), the if it works but that else does not, what's wrong?
I would like it to work like this here, in the input "NAME" by rolling the bar ( link ). When you input label appears and goes up, when you clean input em> label goes down and then disappears. I'm catching js yet.
Thanks to anyone who can help.
var z = document.getElementById('name');//input com ID name
var x = document.getElementById('label');//label com ID label
z.addEventListener("keypress", function () {
'use strict';
if (typeof z.value !== "") {
x.style.opacity = '1';
x.style.bottom = '4em';
x.style.color = '#722872';
} else {
x.style.opacity = '0';
x.style.bottom = '1.5em';
}
seBlur();
seFocus();
});