There is no eval function in jquery; this function is in JavaScript and is used to calculate JavaScript strings and execute as script code. If the parameter is an expression, the eval() function will execute the expression. If The parameter is a JavaScript statement, and the function will execute the specified statement; the syntax is "eval(string)".
The operating environment of this tutorial: windows10 system, jquery3.4.1 version, Dell G3 computer.
There is no eval function in jquery, it is in JavaScript.
eval() function evaluates a JavaScript string and executes it as script code.
If the parameter is an expression, the eval() function will execute the expression. If the argument is a Javascript statement, eval() will execute the Javascript statement.
Syntax
eval(string)
string Required. A string to evaluate that contains a JavaScript expression to evaluate or a statement to execute.
The example is as follows:
<script> eval("x=10;y=20;document.write(x*y)"); document.write("<br>" + eval("2+2")); document.write("<br>" + eval(x+17)); </script>
Output result:
Video tutorial recommendation: jQuery video tutorial
The above is the detailed content of Is there an eval function in jquery?. For more information, please follow other related articles on the PHP Chinese website!