lastChild not working

前端 未结 6 852
予麋鹿
予麋鹿 2021-01-25 01:20

I have the following code:







        
6条回答
  •  渐次进展
    2021-01-25 01:49

    I would use this approach, since ID is a property and not an attribute.

    $(function () {
        var lastchild = $('#div div:last-child').prop('id');
        alert(lastchild);
    });
    

提交回复
热议问题