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

  • 1 {{ upvoteCount | shortNum }}

    Free software that can record more that 10 minutes ?

    spartan14 in Internet Marketing

    Hy all i am more a youtube guy and i plan to make a course for my subscribers with some video series and i need to record videos longer that ... [read more]

  • 1 {{ upvoteCount | shortNum }}

    How Do Highly Successful People Stay Positive?

    Hi Gang, I just stumbled upon this great article and wanted to share! https://[URL="http:// www.fastcompany.com/3055515/6-ways-highly-successful-people-stay-positive"]www.fastcompany.com/3055515/6-ways-highly-successful-people-stay-positive[/URL] So the question begs, how do YOU stay positive? What inspires you to stick with ... [read more]

  • 56 {{ upvoteCount | shortNum }}

    " Great Post, Thanks " Arrrggghhhh

    discrat in Off Topic

    Sorry just felt compelled to write this as I was scouring the Main Forum here today. I see some members ( mostly new but a few old) who felt the ... [read more]

  • 7 {{ upvoteCount | shortNum }}

    How to Market a book?

    Hi guys. I need help marketing a book. Any suggestions? thanks

  • 218 {{ upvoteCount | shortNum }}

    What is the main reason for the 95% failure rate in internet marketing?

    Here is my take on the matter: Look, a lot of people get into the internet marketing business only because of its huge money-making potential without having a love for ... [read more]