Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

label animation css

const inputs = document.querySelectorAll("input");

inputs.forEach((input) => {
  input.addEventListener("focusin", (e) => {
    e.target.previousElementSibling.classList.add("active");
  });

  input.addEventListener("focusout", (e) => {
    e.target.previousElementSibling.classList.remove("active");
  });
});
 
PREVIOUS NEXT
Tagged: #label #animation #css
ADD COMMENT
Topic
Name
6+1 =