execCommand

HTML

<input>
<button id="button">OverWrite</button>

JavaScript

'use strict';

button.onclick = function() {
  document.execCommand('OverWrite');
}