<!DOCTYPE html>
<html>
<head>
<title>Title of the Document</title>
</script>
</head>
<body>
<div>
Input Text:
<input id="input-tag" value="Sample Text" />
</div>
<script>
const inputElement = document.getElementById('input-tag');
inputElement.addEventListener('focus', function(e) {
inputElement.select()
})
</script>
</body>
</html>