Converting a javascript function to pass in an object
<p>I have this javascript which is working great - </p>

<pre><code>var employeename = $("#employeename");
var employeenameInfo = $("#employeenameInfo");
employeename.blur(validateEmployeename);

function validateEmployeename(){
    //if it's NOT valid
    if(employeename.val().length &lt; 4){
        employeename.addClass("error");
        employeenameInfo.text("We want names with more than 3 letters!");
        employeenameInfo.addClass("error");
        return false;
    }
    //if it's valid
    else{
        employeename.removeClass("error");
        employeenameInfo.text("Full Name.");
        employeenameInfo.removeClass("error");
        return true;
    }
}
</code></pre>

<p>However instead of having a big list of this functions for all my different fields I want to pass a field in e.g.</p>

<pre><code>function validateGeneric(field){
</code></pre>

<p>However whatever I try just gives me errors and I'm really stuck. Any help appreciated. This also brings up another problem with the info field, any way I can store the orginal text and just restore that instead of a new string?</p>
