you'd have to tweak that i kind of missed your structure slightly, but the idea is to just use a class and let jquery handle the iterating... --adam
On Nov 27, 2:35 pm, ajpiano <[EMAIL PROTECTED]> wrote: > you can use jquery's .each() which is passed the loop index but to be > honest the best thing to do is to use a class and replace al that code > with > > $(".show_details") > .hover(function() { > $(this).show("slow");},function() { > > $(this).hide("slow"); > > }); > > --adam > > On Nov 27, 2:20 pm, Sai Krishna <[EMAIL PROTECTED]> wrote: > > > Hi, > > I've my PHP code generating rows using certain loop conditons, And > > I'd like to show/hide a div overlay on mouseover and mouseout of a > > text link generated in each row respectively. I wrote the following > > code. this seems to be show div overlay of last row. That is because I > > wrote the function in document.ready. I dont think Jquery lets us put > > javascript in HTML code, So how can I make my code work in such a > > case? > > > $(document).ready(function(){ > > var i= $("#count").val(); > > for(j=0;j<i;j++){ > > var k = "#show_details"+j; > > var refer = "#show" +j; > > $(k).hide(); > > > $(refer).mouseover(function(){ > > $(k).show("slow"); > > }); > > $(refer).mouseout(function(){ > > $(k).hide("slow"); > > }); > > } > > > });