0
I have a function that is called every time the input element is in focus, only the calls are made with a number of different parameters.
How to declare the same function with passing variable parameters ?
input1.addEventListener("focus", function (){
inputPlaceFocus(input1, ph1);
});
input2.addEventListener("focus", function (){
inputPlaceFocus(input2, ph2, olho);
});
function inputPlaceFocus(input, ph, eye){
if (input.value.length == 0){
ph.style.transform = "translate(-6px, -20px) scale(.8)";
ph.style.color = "deepskyblue";
eye.style.visibility = "visible";
}
};
var input1 = document.getElementById("mail");
var input2 = document.getElementById("pass");
var ph1 = document.querySelector("#ph1");
var ph2 = document.querySelector("#ph2");
var olho = document.querySelector(".fas");