$("a, #view").click(function(){ if (this.id == "view") { //code for button } else { //code for links } //common });
You can also use 3 distinct functions for the same effect: $("a, #view") .click(function(){ //common }).filter('a').click(function(){ //links }).end().filter('#view').click(function(){ //button }); - ricardo On Nov 16, 12:47 pm, balavignesh <[EMAIL PROTECTED]> wrote: > Hi friends, > > I am capturing the button & link click on the same > function , like follow... > > code:- > > $("a, #view").click(function(){ > ------ > code for links (a)... > ------- > code for button (#view) > -------- > common for both link & button > -------- > > }); > > To do like the above , how can i capture the link & button > event ? > > Thanks in advance, > Balavignesh