關(guān)于jquery怎么實現(xiàn)刪除 append()添加后的文本
2 回答

Qyouu
TA貢獻1786條經(jīng)驗 獲得超11個贊
樓主在append中加了標簽,所以寫個簡短的代碼。
:last-child 選擇器匹配屬于其父元素的最后一個子元素的每個元素。
1 | $( "#stuff :last-child" ).remove(); |
下面這個也可以實現(xiàn) :last 選擇器選取最后一個元素。
1 | $( "#stuff p:last" ).remove(); |
1 | $( "#stuff p:last-child" ).remove(); |
這個也可以做到.... 挑一個吧
1234 | //$("#test :last-child").remove(); //$("#test p:last-child").remove(); //$("#test p:last").remove(); //$("#test :last").remove(); |
- 2 回答
- 0 關(guān)注
- 1246 瀏覽
添加回答
舉報
0/150
提交
取消