I have multiple classes on a page of the same name. I then have a .click() event in my JS. What I want to happen is the click event only happen once, regardless of multiple
I tried it myself in my project.
All my rows in a table have a class "contact":
My code looks like this:
var contactManager = {};
contactManager.showEditTools = function(row) {
console.debug(row);
}
$('.contact').click(function(event){
console.log("this should appear just once!");
alert("I hope this will appear just once!");
contactManager.showEditTools(event);
});
And I was first scared to see my whole rows as a result in the Firebug console when I executed the code:
But then I realized that the click event was not fired, because no alert-dialog appeared. Firebug shows you just the elements which are affected by the click overiding. So there is nothing to worry.