fei.wang
2024-03-07 80c20bb65f4b73d8beb817e0d595889cd44479dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function addcl() {
    let parent = this.parentNode.parentNode;
    parent.classList.add("focus");
}
 
function remcl() {
    let parent = this.parentNode.parentNode;
    if (this.value == "") {
        parent.classList.remove("focus");
    }
}
 
 
inputs.forEach(input => {
    input.addEventListener("focus", addcl);
    input.addEventListener("blur", remcl);
});