mate64 mate64 - 2 years ago 102
Javascript Question

String to jQuery.function

What's the simplest way to call a string method with ?

Answer Source

If I understand your question correctly, you want to call a method whose name is stored in a string.

If that's the case, you should use square bracket notation instead of (not in addition to) dot notation, and delimit the literal string with quotes:


You can also use the variable you defined initially, without quotes:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download