从模态窗口反击事件

时间:2012-06-25 00:22:43

标签: jquery modal-dialog

我有一张桌子> tr(具有唯一ID)> td(包含HTML编号)> td(包含带有class =“delete”>图像的图像 jQuery脚本以图像为目标并触发请求,更新文件(通过删除具有TR ID的行和TD中的数字)。 成功后,它会通过属性src将图像从“ON”更改为“OFF”。

有效。没问题。

我的剧本:

$(document).ready(function() {

$(‘table td img.delete’).click(function(){

$.get(“deleteRow.php”, {id: $(this).parent().parent().attr(‘id’)} );
$(this).attr(“src”, “img/code_off.gif”);

});
});

然后,我添加了一个模态窗口(使用Zebra Dialog)。 现在,我的问题是:

当我点击“删除”图片时,会触发zebra_dialog。精细。 我可以得到TR的ID。 但是我决不能更新图像src! :(

我的代码(我必须承认这是我的新手,所以它可能是错误的或写得不正确......):

$(document).ready(function() {

$(‘table td img.delete’).bind(‘click’, function(e) {

var id = $(this).parent().parent().attr(‘id’);

e.preventDefault();
$.Zebra_Dialog(‘my question ?’, {
‘type’: ‘question’,
‘title’: ‘my title’,
‘buttons’: [
{caption: 'YES', callback: function() { /* ??????? THERE SHOULD BE THE EVENT FIRED, therefore the IMG shall be updated, which is not, and I can't get it to work... I've been working around this : $('#'+id+'', 'this').attr("src", "img/code_off.gif") } */ }},
{caption: 'NO', callback: function() { alert('num : '+id+''); /* HERE, WE DO NOTHING, so just checking the ID, which is OK, then modal self-closes. */ }}
]
});
});

});

有提示或解决方案的人请?谢谢;)

0 个答案:

没有答案