I have this code:
$('.counter_d').mouseover(function() {
$('#description').html('Counter');
});
$('.selector_d').mouseover(function() {
$('#description').html('Selector');
});
$('.date_d').mouseover(function() {
$('#description').html('Date');
});
and several more, but I think the file could be smaller and even reusable using loops, but I'm not able to bind the description (HTML method) with the selector.
I want to use something like this:
var selectors=['.counter_d','.selector_d','.date_d'];
var description=['Counter', 'Selector', 'Date'];
for(var i=0; i<selectors.length; i++)
$(selectors[i]).mouseover(function() {
$('#description').html(description[i]);
});
Any help? Thanks