anyone?
On Nov 3, 5:28 pm, Liam Potter <[EMAIL PROTECTED]> wrote: > Hi, > I'm having trouble figuring out how I can perform say, a hide animation > on a div, by clicking a button on one div, which uses a class used by > other divs. > > *Lets say I have this:* > > <div class="message"> > <a href="#" class="delete">Delete</a> > <p>Message text</p> > </div> > > <div class="message"> > <a href="#" class="delete">Delete</a> > <p>Message text</p> > </div> > > <div class="message"> > <a href="#" class="delete">Delete</a> > <p>Message text</p> > </div> > > *then the jquery is: > > *$("a.delete").click(function () { > $(".overlay").hide("slow"); > }); > > This will hide all the messages, rather then the one I clicked the > delete button on. > Right now I'm using server side code to give each div a unique id, then > have the jquery like this > > var inc = "<%#Eval("PrimaryKeyID")%>"; > $("a.delete"+ inc).click(function () { > $(".overlay").hide("slow"); > }); > > This works, but it's not the best option, as I need to keep the JS > inline and I'd rather be able to seperate it into a .js file, and use it > in future projects just by writing the correct html then dropping the js > file in the head. > > If anyone can show me the right way to do this, it would be extremely > helpful. > > - Liam