lets assume your button are hyperlinks so the element for that is "a"
$("a").click(function() { var id = this.attr("id"); // variable id will contain the clicked elements ID so you can say something like id.addClass("clicked"); alert(id+" was clicked"); }); On Sun, May 3, 2009 at 4:17 AM, Ingo <ingemar.strandb...@gmail.com> wrote: > > Hi, > > I'm quite new to jQuery and have a question. > > I'm populating a table with rows where some of the columns include > links and buttons. For some of these links and buttons I want to run > some jQuery stuff before it's redirected (acually, I want to have the > result loaded in a div via ajax). In the jQuery function I want to be > able to extract the ID of the button or the href target that was > clicked. > > Now, the problem I'm having is that each of the rows in the table will > generate a different ID for the buttons (otherwise it's not possible > to separate them, right). How will I know in the jQuery function which > button was pressed? > > I would be VERY glad for any help I can get. Please inform me if my > explaination of the problem is unclear. > > Thanks in advance! > > /Ingo >