If I have more number of div tags, then how can i find last div tag in JQuery ? [Resolved]

Posted by Kasani007 under jQuery on 8/5/2014 | Points: 10 | Views : 540 | Status : [Member] | Replies : 2
If I have more number of div tags, then how can i find last div tag in JQuery ?




Responses

Posted by: Webmaster on: 8/5/2014 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
Here is the code snippet for this Kasani.

$("div").last().css("background", "red");

Similarly to find first one, use .first() function.

Thanks

Best regards,
Webmaster
http://www.dotnetfunda.com

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: kgovindarao523-21772 on: 8/6/2014 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
Hi,
This is also a possible answer.
$("div:last").css("background", "red");


Thank you,
Govind

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response