This seems to be a beginners question (I've googled a lot since I am a beginner at JavaScript) but I still can't get it to work. Could someone please help me?
I have a list menu with numbered links. Each links has it's own submenu that I want to show/hide on mouse over. The link and the submenu are connected in the way that they have similar ID.
Like this...
Link:
a id=815 class="menuItem" href="/default____815.aspx">
Hidden div:
div id="subMenudiv815" class="HoverTopSubMenuBlock" style="display:none">
Since I have several menuItems I've tried to loop a function that's working when you specify the divs manually. This is what I've tried with:
var j = [66,815,1006,9581,1239,1206,816];
var menu = [];
var hoverdiv = [];
for (var i = 0; i < j.length; i++) {
menu[i] = "#"+j[i];
hoverdiv[i] = "#subMenudiv" + j[i];
$(rubrik[i]).hover(function() {
$(hoverdiv[i]).show();
}, function() {
$(hoverdiv[i]).delay(1000).hide(0);
});
}
Ive tried to use the each()-function but that didn't help me much.