Say I have 3 div elements with one class, hovering one of them I want the background of the inner element to change to a red. I tryed to add an ID for each element like this:
<div class="content"><div class="yellow_hover"></div></div>
<div class="content"><div class="yellow_hover"></div></div>
<div class="content"><div class="yellow_hover"></div></div>
Jquery
$('.content').each(function(i, div) {
div.id="div" + (i+1);
});
Result
<div class="content" id="div1"></div>
<div class="content" id="div2"></div>
<div class="content" id="div3"></div>
Now I need something like this, yeah I know... I'm lost:
$(div+i).hover(function() {
$('.yellow_hover').css('background-color','#FF9900');
});