I used the $(select).append() method to add one div inside another div, but I wanted to close it on click of an image. So I added an image and another $(select).button().click( { $(select).hide() }) to achieve this functionality. However, when clicking the close image, nothing happens...
$(document).ready(function() {
$("#subCre").click(function() {
cust = $("#customer").val();
address = $('#address').val();
phone = $('#phone').val();
amt = $('#initamount').val();
user = '<%= session.getAttribute("user").toString()%>';
type = '<%=session.getAttribute("type").toString()%>';
alert(cust + address + phone + amt + user + type);
$.post("../processor/proc2.jsp",
{
customer: cust,
address: address,
phone: phone,
initamount: amt,
user: user,
type: type
},
function(data, status) {
if (status === "success") {
if(data.length == 11) {
$("#SystemMessages").append('<div class="Msg draggable"><img class="close" src="../mime/close.png">Account Added</div>'); // **Here one div
} else {
$("#SystemMessages").append('<div class="errorMsg draggable"><img class="close" src="../mime/close.png">'+ data + '</div>'); //** here 2nd div
}
$("#customer").val("");
$('#address').val("");
$('#phone').val("");
$('#initamount').val("");
}
});
$(".close").button().click(function() {
$(".close").parent().css("visibility", "hidden");
});
});