Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我经常使用 jquery 的data()方法而不是创建全局变量。通常,我将它们附加到我的<body>-tag 上。
<body>
但是有什么方法可以跳过 dom 元素吗?做类似的事情会是个坏主意$.cache['foo'] = 'bar';吗?
$.cache['foo'] = 'bar';