aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources/assets/js/profile.js
blob: bce94daf3afa082540095ccad40ca1aa0e990eaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
$("#avatarFile").on("change", () => {
    var preview = document.querySelector('#image-preview');
    var file = document.querySelector("#avatarFile").files[0];
    var reader = new FileReader();

    reader.addEventListener("load", () => {
        preview.src = reader.result;
    }, false);

    if (file) {
        reader.readAsDataURL(file);
    }
});