Jquery each issues - causing multiple instances

In my page I have multiple instances of the .close class on various objects.

I am trying to use the jQuery each function to look for all of them, then depending on which is actually clicked, calling an alert.

Here is a snippet of my code:

	var removetab = $(this).parent().parent().attr("id");
	var tabid = removetab.split("-")[1];
	$("#tab-" + tabid + " .close").click(function() {


This issue is, if there are 4 instances of the .close class on the page, when the first instance is clicked, the alert fires 4 times, the second instance, it fires 3 times, and so on.

How can I have this just pull each of the .close functions and look for a click on the independent section?


It’s bubbling up so you need to stop that.

    $("#tab-" + tabid + " .close").click(function(event) {