user425232
user425232

Reputation: 23

Execute dynamic code

i have following in a string.

javascript: __doPostBack('GridWidget', 'Edit$0')

how can i dynamically execute this?

Upvotes: 0

Views: 1365

Answers (2)

Paul Creasey
Paul Creasey

Reputation: 28894

var js = "javascript: __doPostBack('GridWidget', 'Edit$0')".replace("javascript:","");
eval(js)

Upvotes: 0

Zach
Zach

Reputation: 7940

Remove the "javascript:" from the front, and call eval() on the string.

Upvotes: 1

Related Questions