Suppose there is such a layout

<div class="1"> <!-- some content--> </div> <div class="1"> <!-- other content--> </div> 

I need that when you hover on a specific div of class 1, the action takes place exactly with the div on which it induced

  • one
    @timmi, To format a code, select it with the mouse and click on the button 101010 of the editor. - Oleg
  • Possible duplicate issue: jQuery selectors - MSDN.WhiteKnight

2 answers 2

 $('.class_name').hover(function(){ $(this).css('background-color','#CCC'); }); $('.class_name').mouseenter(function(){ $(this).css('background-color','#CCC'); }); $('.class_name').mouseover(function(){ $(this).css('background-color','#CCC'); }); 
  • a little wrong formulated. i am sorry that the actions were performed with exactly that div that he brought - Timmi55
  • Corrected the answer. Use $ (this) and some method - Deonis
 $('div').mouseover(function () { $(this).text('true'); });