jQuery 选择器给出有关全局范围的警告

发布于 2024-12-15 12:38:35 字数 367 浏览 2 评论 0原文

我正在尝试整理我刚刚编写的一些嵌套 jQuery ajax 调用。如果将一些代码移出到另一个函数中,我在执行时会收到以下警告。

"Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead."

这是触发该警告的调用之一:

var access_token = $("input#access_token").val();

它位于 javascript 顶层的常规 javascript 中,即全局。如何解决这个问题?

谢谢。

I'm trying to tidy up some nested jQuery ajax calls that I have just written. If move some of the code out into another function I get the following warning upon execution.

"Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead."

This is one of the calls that is triggering that warning:

var access_token = $("input#access_token").val();

It's inside a regular javascript out the top level of javascript i.e. Global. How to go about fixing this?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文