将在我的项目中多次显示jquery弹出窗口。我想在每次使用不同的消息填充div中的标签,例如......
var popUpMessageSave = "You have successfully saved.";
loadPopUp(popUpMessageSave);
var popUpMessageFail = "You have failed to save.";
loadPopUp(popUpMessageFail);
不确定每次如何填充标签??
<div style="display: none;">
<div id="saveDialogSingleFeature" title="Save Complete">
<input type="text" title="Name" value=""/>
<label></label>
</div>
</div>
function loadPopUp(popUpMessage) {
$("#saveDialogSingleFeature").dialog({
width: "auto",
height: "auto",
position: { my: "top", at: "bottom", of: $("header") },
show: { effect: "slideDown" },
hide: true,
closeOnEscape: true
}).parent().appendTo("form:first");
//clear label and add new
$('input:text').next('label').html("");
$(this).next('label').html(popUpMessage);
setTimeout(function () {
$("#saveDialogSingleFeature").dialog('close')
}, 5000);
}
更新 在DIV中添加了一个ID并添加为空并附加到loadPopUpMessage()
$("#popUpLabel").empty();
$("#popUpLabel").append("some Text");
<input type="text" id="popUpLabel" value=""/>