$("#dialog-form").dialog({
autoOpen: false,
height: 320,
width: 320,
modal: true,
show: 'slide',
buttons: {
"Agregar Tour": function () {
var bValid = true;
allFields.removeClass("ui-state-error");
bValid = bValid && checkLength(adl, "Adultos", 1, 5);
bValid = bValid && checkLength(chls, "Niños", 0, 5);
bValid = bValid && checkLength(fecha, "Fecha", 1, 16);
var id = $(this).val("id");
var string = 'tourid=' + tourid;
//var tourid = '<?php echo $moneda ?>';
//alert(tourid);
if (bValid) {
$.ajax({
url: "add_item.php",
data: "tourid=" + tourid + "&adl=" + adl.val() + "&chl=" + chls.val() + "&fecha=" + fecha + "",
dataType: 'json',
type: "GET",
cache: false,
success: function (data) {
var regis = data[0];
var titulo = data[6];
var desc = data[7];
var total = data[12];
var foto = data[15];
var items = data[21];
var ruta = "images/hoteles/" + foto + "";
$("#containerx").append("<div id='containerx' class='koko' ><b><font color='#3399CC'>" + titulo + "</font></b><br>" + desc + "<br>" + "<b><font color='#ff0099'>Sub-total </font></b><image src='images/arrow.gif'> $" + total + " MXP " + "<a href='#' id=" + regis + " class='delele'>" + "<image src='images/delete.gif'></a></div><div style='clear:both;'></div>");
$("#containerx.koko").fadeTo(1000, 0.7);
$("#dialog-message").dialog({
modal: true,
show: 'slide',
buttons: {
Ok: function () {
$(this).dialog("close");
}
}
});
$("#items").html("<div id='items'>[" + items + "]</div>");
$('#load').fadeOut();
}
});
$(this).dialog("close");
}
},
Cancel: function () {
$(this).dialog("close");
}
},
close: function () {
allFields.val("").removeClass("ui-state-error");
}
});
$(".add-item").button().click(function () {
tourid = $(this).attr("id");
$("#dialog-form").dialog("open");
});
答案 0 :(得分:0)
在此“删除”事件等上,您需要使用“实时”jquery live http://api.jquery.com/live/或在添加内容后再次附加事件。
只有在呈现内容时,所有事件都会附加,如果您要动态添加新内容,则需要再次附加事件(如果它们不是“实时”事件)。
jquery“Live”事件将尝试附加到动态添加的内容:)。阅读我添加的文档,你会知道所有。