i have 3 divs with the same class.
<div id="qq1" class="cl">sentence</div>
<div id="qq2" class="cl">sentence</div>
<div id="qq3" class="cl">sentence</div>
well i'd like to know how can i write correct code for entering mouse calling with one function for 3 divs (calling cl class) and returning the correct id for change css.for ex:
<script>
$('.cl').live('mouseenter', function() {
var currentId = $(this).attr('id');
$('currentId').css("background-color", "#99cc33");
$('currentId').css("color", "white");
});
$('.cl').live('mouseleave', function() {
var currentId = $(this).attr('id');
$('currentId').css("background-color", "white");
$('currentId').css("color", "#404040");
});
</script>
But there's something wrong 'cause it doesn't work
<div>with theclclass... I'm curious, why aren't you just doing this with a:hoverin a CSS rule? No Javascript is required.