Mootools:调用null方法

发布于 2024-12-27 10:22:17 字数 139 浏览 4 评论 0原文

我有类似 $$('[map="true"]').addClass('hidden'); 但有时地图不存在。我可以在不破坏js并且在方法调用之前不添加if条件的情况下调用mootools中的方法吗? AFAIR jQuery 默认检查此项。

I have something like $$('[map="true"]').addClass('hidden');
but sometime map is not exists. Can i call methods in mootools without breaking js and not adding if condition before method call? AFAIR jQuery check this by default.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

箹锭⒈辈孓 2025-01-03 10:22:17

如果您的意图是使用 [map="true"] 作为选择器,就像 $$ 一样,那么它是一个字符串,而不是变量赋值。

 $('[map=true]')

If your intention is to use [map="true"] as a selector, as seems to be with $$, then it is a string, not a variable assignment.

 $('[map=true]')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文