call function with parameters on any event using jquery
<p>Hi just wanted to know if this is a correct way. I know we can pass data using object notation and use it. But just wanted to know if the below code is correct. I am not sure about the below syntax.</p>

<pre><code> function isValid(errMessage,errId,errClass){
    alert();
    if($("#"+errId).val()==""){
        $("."+errClass).show();
        $("."+errClass).html(errMessage);
        return false;
    }else{
        $("."+errClass).hide();
    }
}

$("#fname").on("blur",isValid("please enter first name","fname","ferror"));
</code></pre>

<p>I have seen syntax like below: </p>

<pre><code>function test(){
    alert("Hello World");
} 
$("#fname").on("blur",test);
</code></pre>

<p>check this link for output
<a href="http://jsfiddle.net/susheel61/M2jsX/" rel="nofollow">http://jsfiddle.net/susheel61/M2jsX/</a></p>

<p>so just want to make clear if passing parameters directly works or not. </p>
