how to use var value name as function name in JavaScript -


hi guys can use value function name in javascript? have functions same name input values such as:

var ta = $('li.ramin.active').attr("id"); var act = $('input[name="'+ta+'_acceptdeny"]:checked').val();   act(freq, meid);  // question 

in way have error "uncaught typeerror: act not function" yes know act not function want use var act value function name!! need know how can that? all

you can use window[act](freq, meid)

thanks justin niessner pointing out work if act defined in global scope. use eval, however, considered unsafe.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -