mouse - jQuery Hover with Class Single Item -
trying figure out how apply common class jquery hover single item @ time if there multiple items same class on page.
i.e. html
<div class="button">button</div> <div class="button">button 1</div> <div class="button">button 2</div>
js
jquery('.button').hover(function () { jquery('.button').addclass('button-hover'); }, function () { jquery('.button').removeclass('button-hover'); });
how can if hover on 'button' not buttons add class ? i.e. want add class when focused on single div ?
thnks
use this
:
jquery('.button').hover(function () { jquery(this).addclass('button-hover'); }, function () { jquery(this).removeclass('button-hover'); });
Comments
Post a Comment