change value input text javascript code example

Example 1: javascript set input field value

document.getElementById("myInputID").value = "My Value"; //set value on myInputID

Example 2: javascript change color of text input

document.getElementById("yourInputID").style.color = 'the color of your choice';

Example 3: Javascript get text input value

var inputValue = document.getElementById("myTextInputID").value;

Example 4: javascript input value change

function updateInput(ish){
    document.getElementById("fieldname").value = ish;
}

Tags:

Html Example