Hello,
Is it possible to call a function by using the strings ?.
i.e i have a variable var target = 'next';
. Using this string i want to call the jquery method next()
. Should i use target + '()'
(this is bit foolish) to call next()
???
I know it can be done using conditional
statements. Since it is a var got from users, it is a heavy work to use conditional statements for all that.
i.e users will enter prev
, siblings
etc. So the respective functions should be called.
In my current project, i use more conditional statements for this thing. So i am fainted and it is difficult to manage.
I know it is bit impossible but any alternative suggestions will be helpful.