我想使用插件自定义确认消息。我有php表记录,每行都有删除按钮。我如何自定义确认弹出,就像下面的jquery插件一样?自定义确认弹出
<?php echo'
<tr class="record">
<td align="center"><a href="#" id="'.$row["counter"].'" class="delbutton"><img src="images/del.png"></a></td></tr>';
?>
<script>
$(function() {
$(".delbutton").click(function(){
var element = $(this);
var del_id = element.attr("id");
var info = 'id=' + del_id;
if(confirm("Are you want to continue ?"))
{
$.ajax({
type: "GET",
url: "delete.php",
data: info,
success: function(){
}
});
$(this).parents(".record").animate({ backgroundColor: "#fbc7c7" }, "fast")
.animate({ opacity: "hide" }, "slow");
}
return false;
});
});
</script>
jQuery插件
<script>
$(function() {
$("#dialog-confirm").dialog({
resizable: false,
height:140,
modal: true,
buttons: {
"Delete all items": function() {
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
});
</script>
</head>
<div id="dialog-confirm" title="Empty the recycle bin?">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>
检查http://stackoverflow.com/questions/43955/changing-the-default-title-of-confirm-in -javascript底线你可以做到这一点,而无需使用插件,你可以在你的PHP中使用相同的插件,如果你想 –