当我在具有相同类的输入上单击(焦点)/单击输出(模糊)时,我想执行一个操作,但我单击的输入应该不会受到影响,而不是像我在此处的示例http://jsfiddle.net中的所有输入/HTZr2/ **点击一个输入,现在所有的描述都显示出来了。我想只显示我单击的输入的描述。
<div class="form-wrapper">
<div class="form-element ">
<input type="email" name="email" id="email" value="" autofocus="autofocus" tabindex="1">
<p class="description">First's input description!</p>
</div>
</div>
<div class="form-wrapper">
<div class="form-element ">
<input type="email" name="email" id="email" value="" autofocus="autofocus" tabindex="1">
<p class="description">Second's input description!</p>
</div>
</div>
<div class="form-wrapper">
<div class="form-element ">
<input type="email" name="email" id="email" value="" autofocus="autofocus" tabindex="1">
<p class="description">Third's input description!</p>
</div>
</div>
<div class="form-wrapper">
<div class="form-element ">
<input type="email" name="email" id="email" value="" autofocus="autofocus" tabindex="1">
<p class="description">Forth's input description!</p>
</div>
</div>
和我的 JS:
window.addEvent('domready', function() {
$$('.form-element > input').addEvents({
focus: function(){
$$('.form-element').addClass('form_element_active')
},
blur: function(){
$$('.form-element').removeClass('form_element_active');
}
});
});
谢谢!