jQuery.globalEval()

jQuery.globalEval()

jQuery.globalEval( code )Returns:

Description: Execute some JavaScript code globally.

This method behaves differently from using a normal JavaScript eval() in that it's executed within the global context (which is important for loading external scripts dynamically).

Example:

Execute a script in the global context.

function test() {
  jQuery.globalEval( "var newVar = true;" )
}
test();
// newVar === true

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jquery.com/jQuery.globalEval

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部