Tony Brackins26,244 Points
Change a value of an input
I thought just using the .value= "" would do the trick, however, it made no change.
I used: document.querySelectorAll("input[name=inputName]").value = "test"; but the value didn't change.
leong shing chew5,618 Points
If you have the id of the element, you could :
var element = document.getElementById('element_id'); element.value = 'random_value';
or if you want to use querySelectorAll, assuming there is only one element that matches the query:
var elements = document.querySelectorAll("input[name=inputName]"); elements.value= 'test';
It doesn't work in your example because querySelectorAll return a nodeList rather than a single object that you are using it for.