10
<script>
$(document).on("change", ".image_click", function (e) {
var file = e.target.files[0];
var maxSize = 500 * 1024; // 500 KB
if (file && file.size > maxSize) {
alert("File is too large! Maximum size is 500 KB.");
$(this).val(''); // reset input field
return;
}
var clickedBtnID = $(this).data('id');
$('#' + clickedBtnID).attr('src', URL.createObjectURL(file));
});
</script>