Set the value of an input field using JavaScriptThis is one way of doing it: use ‘setAttribute’ function: