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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -