954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

$(this).attr() trouble

$(document).ready(function() {
	$(".alert").click(function() {
		{
			var id = $(this).attr("id");
			alert(id);
			$(id).dialog();
			return false;
		}
	});
});


Ok it's alerting the id AFTER it alerts an undefined.. so it alerts "undefined" and then "5" or whatever the number may be.
What am I doing wrong?

Tenaciousmug
Junior Poster in Training
53 posts since Jun 2010
Reputation Points: 10
Solved Threads: 2
 

do you have multiple classes named .alert?

fobos
Posting Whiz in Training
297 posts since Feb 2009
Reputation Points: 29
Solved Threads: 52
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You