你近了 在您使用它的上下文中,“ this”是指ajax请求,而不是发出事件的事物。要解决此问题,请在发出ajax请求之前存储此副本:
}else{ var me = this; $.ajax({ ... success: function(data){ description = data[0]; $(me).css('width', '70%');
你近了 在您使用它的上下文中,“ this”是指ajax请求,而不是发出事件的事物。要解决此问题,请在发出ajax请求之前存储此副本:
}else{ var me = this; $.ajax({ ... success: function(data){ description = data[0]; $(me).css('width', '70%');