var temp = document.createElement('input'); temp.value="xx"; document.body.appendChild(temp); temp.select()