set input value js code example
Example 1: javascript set input field value
document.getElementById("myInputID").value = "My Value";
Example 2: Javascript get text input value
var inputValue = document.getElementById("myTextInputID").value;
Example 3: insert value to html input with javascript variable
function product(a, b) {
return a * b;
}
function setInputValue(input_id, val) {
document.getElementById(input_id).setAttribute('value', val);
}
Example 4: javascript change input value
document.getElementById("ID").value = "Tamer Jarrar";