JQuery and Dynamic javascript execute
Suppose one line or few lines of javascript is assigned to a variable. How could I execute it by jQuery.
开发者_StackOverflow中文版Suppose alert($("#txtName").val());
The above code is assigned to a variable then how could I execute it by jQuery at run time.
You could use the eval
function. Example:
var someCommand = 'alert($("#txtName").val());';
eval(someCommand);
精彩评论