Showing posts with label call function from string. Show all posts
Showing posts with label call function from string. Show all posts

Thursday, January 3, 2013

Jquery call function, name taken from a string

Get function name from a string.
var formcheck = "function_name";
if (typeof window[formcheck] === 'function'){
    formok = window[formcheck]();
    e.preventDefault();
}

function function_name(){
    alert("Checked");
    return false;
}