HTML textbox input- Always select all text on click
<p>How do I achieve the following behavior in an html text input: when a user clicks the input, all the text will be selected, even if it's already selected. Thus there won't be any possibility to delete/select certain characters.</p>

<p>currently I have the following:</p>

<pre class="lang-js prettyprint-override"><code>elm.on('click', function(e) {
    e.preventDefault();
    $(this).select();
});
</code></pre>

<p>but if the text is selected then a click displays a carret.</p>