jquery:获得当前点击对象 : $(this)
$(".state").click(function() { var val=$(this).attr("id"); alert(val); }); $("#tbody td").click(function() { //这时能够获得正确的被点击对象 var tdID = $(this).attr(‘id‘); $.post(appPath + "/app/teach/train/save/", { publishID : $(‘#publishID‘).val(), teachDate : $(‘#teachDate‘).val(), stage : $(‘#stage‘).val() }, function(result) { if (result.state == ‘succ‘) { //在此处不能用$(this)获得被点击的对象,得到的是ajax对象 $(‘#‘ + tdID).removeClass(); $(‘#‘ + tdID).addClass(state); } else { top.errorLayer(‘维护排班‘, ‘保存失败‘); } }, ‘json‘); });
相关推荐
Hhanwen 2020-07-05
yanqianglifei 2020-02-21
xiaodaiwang 2019-12-19
fengjing81 2019-12-02
dxyadc 2019-10-27
adayan0 2019-10-22
lfjjia 2010-11-09
herryyy 2012-12-18
PANH 2019-07-01
starksummer 2019-03-31
上海彭彭 2019-06-30
CloasGao 2019-06-29
82530995 2019-06-28
雪飞海 2019-06-26
成长之路 2018-10-18
zilianxiaozhu 2018-09-12
adayan0 2018-07-20
jinkun00 2015-05-09
FEvivi 2018-02-22