javascript – Want to change video src with input field

Beginner here using javascript for the first time. I want to have a video playing on my site, but when I input a certain word in the input field and submit it, I want it to change the src attribute of the video.

I’d have five or six different words and each of those would have a different video “assigned” to them.

Here’s what I tried so far:

<body>
    <div>
        <form>
            <input type="text" id="field" oninput="let p=this.selectionStart;this.value=this.value.toUpperCase();this.setSelectionRange(p, p);">
            <button type="submit" id="button">CONFIRM</button>
        </form>
    </div>
    <div>
        <video src="https://stackoverflow.com/vid1.mp4" id="video" width="640" height="480"  loop="true" autoplay="autoplay" muted></video>
    </div>
</body> 

Javascript:

const myInputField = document.getElementById('field');
const myButton = document.getElementById('button');
const myVideo = document.getElementById('video');
    
myButton.addEventListener("click", changeSrc);

var a = myInputField.value;

function changeSrc(event) {
    event.preventDefault ();
    
        if (a === "BRUH") 
        {
            myVideo.src = "http://stackoverflow.com/vid2.mp4";
        }
        else 
        {
            ;
        }
    }

Thanks!