I have a variable
var functionName="giveVote";
What I need to do is, I want to call function stored in var functionName. I tried using functionName(); . But its not working. Please help.
Edit Based on the same problem, I have
$(this).rules("add", {txtInf: "^[a-zA-Z'.\s]{1,40}$" });
rules is a predifined function which takes methodName:, here I have hardcoded txtInf. But I want to supply a javascript variable here, to make my code generic. var methodName="txtInf";
Here I want to evaluate methodName first before being used in rules function.
$(this).rules("add", {mehtodName: "^[a-zA-Z'.\s]{1,40}$" });