<input type="text" id="example"> <input type="submit" value="Submit" onclick="document.getElementById('example').setAttribute('value','My default value')">