Trying to replace input value results in TypeError: input.replace is not a function [closed]

For some reason this code is responding in a error of “input.replace is not a function” when submit button is pressed

window.onload = function() {
        var input = document.getElementById('input');
        var submit = document.getElementById('submit');
        var newStr;
        var placeholder = document.getElementById('placeholder');

        submit.addEventListener("click", function(){
             newStr = input.replace(/n/g , "m");
             var newText = ("Sorry! Wrong Answer, the name is spelled United 
             Kingdom. Not:" + input)
            document.getElementById("placeholder").textContent = newText;


        });

    }

Answer

var input = document.getElementById('input'); returns DOM element not value.

update it with.

var input = document.getElementById('input').value; 

But move it inside of the function(){ because if you leave it being called at the start of the page loading you will be setting input to the value of the input field at the time the page loads and not the value at the time the submit button is clicked