return focus and select text using jquery
<p>I am validating text input on a html form, and would like to focus and select the text if it is invalid.</p>

<p>If my validation function looks like (just an example):</p>

<pre><code>jQuery.fn.DateHelper = function(text){
    return this.each(function(){
    //Make sure we're dealing with text-based form fields
    if(this.type != 'text')
    return;

    // call the processNumber function when the onBlur event is fired and there is a value in the field.
    $(this).blur(function() {
        if (this.value != '')                 
            processNUmber(this);
        });

    function processNumber( txtField ) {
        if (!isNan(txtField ))  {
            alert("not a number");
            this.focus(); // this does not work.
            // how to select text?     
        }

    }

};
</code></pre>
