Changing img title in an array with JS [duplicate]

I’ve just started learning HTML, CSS and JavaScript.
I have an image gallery and titles of those images in an array. Now when I click on picture in gallery it shows the title of said image in a text input field. I want to type in a new title in same field and after clicking on submit button for title to change and be adjusted in the array so if I hover over the image again it shows the changed title. All written in JS.

Been trying and refining this for hours and got the console to show no errors but code isn’t doing anything, maybe someone could take a look and see what I am missing.

        var image=document.querySelectorAll(".galery img");
        var new=document.querySelector(".edit input[type=text]");
        image.title=new;
        }

Your help and guidance would be much appreciated.