want to create a loop in jquery based on a value
<pre><code> var cnt = document.getElementById('counter');
 //row1 is incremental and based on some value from 
 // database this value will increase. want to create a loop Here

$(".row1").mouseenter(function(){
    $(this).addClass("answer_hover_row");
    document.getElementById('row1').style.visibility = "visible";
}).mouseleave(function(){
    $(this).removeClass("answer_hover_row");
    document.getElementById('row1').style.visibility = "hidden";
});

$(".row2").mouseenter(function(){
    $(this).addClass("answer_hover_row");
    document.getElementById('row2').style.visibility = "visible";
}).mouseleave(function(){
    $(this).removeClass("answer_hover_row");
    document.getElementById('row2').style.visibility = "hidden";
});
</code></pre>

<p>I am trying to create a loop for the mouseenter function so that i can create it for as many divs that are printed dynamicaly. The count of the divs is in a hidden text box with id as counter. Please help me with the loop. .each function wont work out for me</p>
