开发者

Why ":last" and ":last-child" does not work?

I'm trying to select the last div with class my_class inside div with id a.

I tried several options with :last and 开发者_如何学运维:last-child but none of them worked.

Here is on try.

What am I doing wrong ?


Your selector works, you just weren't including jQuery in your fiddle, here's an updated/fixed version: http://jsfiddle.net/eU7By/3/

On the left panel, make sure to select jQuery as your library, by default it's MooTools that's included...it is after all built by the MooTools guys :)


This should work for you:

$("#a div.my_class:last");

fiddled -- oh and the reason your example wasn't working is because you had jsFiddle set to MooTools, not jQuery.


Looks like you selected MooTools instead of jQuery in the left hand options.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜