jQuery - Fetching ID names

by almondj 2 replies
Here's the situation I have a div that has animation. I want to use this animation on other divs. What I'm trying to figure out is how to get the actual ID name of the element that was clicked. For example, if '#id1' was clicked, then I would like '#id1' as a var. Anyway to do this? Thanks all!

Code:
$("#cfirst").click(function () {
if ($("#first").is(":hidden")) {
	if( == "250px") {
	  var  = 1000;
	  //animate bar
	  $("#main").click(function(){
	    $(this).animate({"top": "50px"}, 1000 );
	    var  = "50px";
		});
	  }
	if($("#second, #third").is(":visible")) {
	$("#second, #third").slideUp("1000");
	var  = 500;
	}
	$("#first").delay().slideDown("1000");
}
});
#website design #fetching #jquery #names
Avatar of Unregistered
Avatar of Unregistered

Trending Topics