开发者

Jquery how to find last child

For those who know JQuery - must be effort less question - I'd like to get the elemenet which is the last child of another element (of type 'input' that I know its ID ('myID').

What is the corr开发者_StackOverflow中文版ect query: I tried:

$("input:last-child", $("#myID")); 
 $("#myID input:last-child") 

But it didn't work


Try:

$("#myID input:last") //for the last

$("#myID input:first") //for the first


You can use last method too. Something like this:

$("#myID").last();  

But make sure that you have jquery 1.4.X. While :last matches only a single element, :last-child can match more than one: one for each parent.

and i think what you have write will work in this way..

$("#myID input:last-child").val();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜