$("#galleryImage").change(function () {
imgpath = getObjectURL(this.files[0]);
$("#galleryImage-container").prepend("<div class='img-thumb img-item galleryImage' data-index='" + index + "'><img class='thumb-icon' imagepath='' src='" + imgpath + "' data-index='" + index + "'><div class='img-remove removeGalleryImg' data-xindex='" + (index++) + "' >x</div></div>");
});
$("body").on("click", ".removeGalleryImg", function () {
var num = $(this).attr("data-xindex");
$("div[data-index=" + num + "]").remove();
});
function getObjectURL(file) {
var url = null;
if (window.createObjectURL != undefined) {
url = window.createObjectURL(file);
}
else if (window.URL != undefined) {
url = window.URL.createObjectURL(file);
}
else if (window.webkitURL != undefined) {
url = window.webkitURL.createObjectURL(file);
}
return url;
}