Modify what the user typed on a text box onsubmit and select?
<p>I'm using a script to return what the user types on an inputbox without www.</p>

<p>I want the modification to work in the inputbox itself. Is this possible?</p>

<p>Like for example the user types: www.example.com and when he presses GO www. disappears from what he typed and then the text is highlighted (selected).</p>

<pre><code>&lt;input type="text" id="url" /&gt;
&lt;input type="button" id="submit" value="Go!" /&gt;

&lt;div id="output"&gt;&lt;/div&gt;

&lt;script&gt;
$("#submit").click(
    function() {
        var url = $("#url").val();

        if(url.match(/^www\./))
        {
            url = url.substring(4);
        }

        $("#output").html(url);
    }
);
&lt;/script&gt;
</code></pre>
