JavaScript: Updating an input value from an onclick

From The Travis van der Font Wiki
Jump to: navigation, search
function exampleFunc(value) {} // ... process whatever

document.getElementById('btn_calculate').addEventListener('click', function (event)
{
    event.preventDefault();
    
    document.getElementById('result').value = exampleFunc(document.getElementById('input').value);
});