0
我有codepen验证码:https://codepen.io/RaoniSousa/pen/Zpkxbb:替代这在Javascript
var x = document.querySelectorAll('.label'), //label com ID label,
z = document.querySelectorAll('.input'); //input com ID name;
function myFunction() {
'use strict';
if (this.value !== "") {
this.style.opacity = '1';
this.style.bottom = '4em';
this.style.color = '#722872';
console.log(this);
} else {
this.style.opacity = '0';
this.style.bottom = '1.5em';
console.log(this);
}
}
在功能上面,我想只改变标签(VAR X)的风格。我知道“这”指的是。输入(VAR Z),但是,我想申请一个样式标注为我改变了他的相关输入值,但如果我使用一个for循环,他称所有标签都是同一时间。有没有办法通过使用'this.style'或其他人知道此代码的另一种替代方法来调用var z的var z intead?
我想它的工作原理是在这里发生(滚下来吧,直到达到联系我部分):https://codepen.io/freeCodeCamp/pen/YqLyXB
在此先感谢。