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.
我有一个带有两个内部页面的主页。
每次我在每个事件上附加事件
$(document).("pageshow","pageXXX",function(){ alert("This is a test") })
警报在主页上被触发两次,此外,当我调用内部页面时,会为该页面执行自定义操作,而且主页上的 pageshow 触发的警报也会被触发。
我尝试使用 pagecreate 而不是使用 pageshow 但它不喜欢我,因为它在页面加载后仅触发 1 次,并且我需要在每次显示页面时触发事件。
您是否可能缺少“#”符号?pageXXX 是 id 吗?
您可以尝试使用“#pageXXX”,如下所示:
$(document).("pageshow","#pageXXX",function(){ alert("This is a test") })
希望有所帮助!