user1622967
user1622967

Reputation: 33

jQuery last Element with certain css property

I have a list of the same divs which are hidden. Now there are few of the same div which are not hidden, how do i get the last of them?

Upvotes: 0

Views: 65

Answers (4)

Richard Heath
Richard Heath

Reputation: 347

Try the jQuery last selector

$(".cssName :last")

last Selector

Upvotes: 0

adeneo
adeneo

Reputation: 318182

var elem = $(".myclass:visible").last();

FIDDLE

Upvotes: 2

Matt McHugh
Matt McHugh

Reputation: 4095

Use the last() function from a selector that can select the divs that aren't hidden.

http://api.jquery.com/last/

Upvotes: 1

Related Questions