Call a JavaScript function name using a string? -


How can I hook up a function name as a string?

I 'prototype. I am using JS, although it is not prototype-specific.

  $ (inputId) .blogger ('click', formData.fields [x]. Onclick);  

This complains in Javascript that I do not have a handler function. I like eval () .

If the function is in the global scope, you can use it window object:

  var myFunc = window [myFuncName];  

Comments