Hi. I am trying to associate a sequence of events with multiple divs using the javascript jQuery library. Here is what I am trying to do.
There will be a lot of divs on the screen with id div1 div2 div3 ... div10 etc. However, only the first div with id 'div1' will be displayed with all other hidden divs. When the user is hovering on div1, div2 should be displayed, and when he is hovering on div 2, div 3 should be shown, and this should continue sequentially until the last div.
I managed to find a solution using the following jQueries method.
$('div').each(function(){
$(this).mouseover(function(){
$(this).next().show();
});
});
However, since I recently learn javascript, I wanted to redo it using the FOR loop, and it will not work.
for (var i=1; i<11; i++){
$('#div' + i).mouseover(function(){
$('#div' + (i+1)).show();
});
}
, , , , "i" , , . -, , , , jQuery.next(), javascripts FOR. .