$(‘.button‘).click(function () {
var active = $(‘.buttons-tab a‘).children(‘input‘).attr(‘value‘)
alert($(this).attr(‘id‘))
alert(this)
})
//可以看出来$(this)是jquery对象,而this是DOM对象:!!!!!!!!!!!!!!!!!!!!!!!!!!
alert($(this)); 弹出的结果是[object Object ]
alert(this); 弹出来的是[object htmlImageElement]
如何获取$(this)子对象?=========> find()
$(this).attr(‘id‘)
转自 https://blog.csdn.net/haoaiqian/article/details/62882594