Ron Ron - 1 year ago 84
Javascript Question

Get class name from id in the last apperance of that div in jquery

<div class='user user1' id='newuser'></div>
<div class='user user2' id='newuser'></div>
<div class='user user3' id='newuser'></div>

For getting class name from id i can use

Here how can i get the class name of the last div whose id is newuser ?

if id need to unique then how can i get the class name of last class named user ?

Answer Source



Above code will get the class name and alert it. Hope this will help you :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download