牧羊人nacy
如果要选择最后一个子元素,并且需要具体说明元素类型,则可以使用选择器last-of-type这是一个例子:$("div p:last-of-type").css("border", "3px solid red");$("div span:last-of-type").css("border", "3px solid red");
This is paragraph 1
This is paragraph 2
This is paragraph 3 This is paragraph 4This is paragraph 5