在页面内写入的脚本会影响另一页面 [英] Script written inside a page affects in another page
本文介绍了在页面内写入的脚本会影响另一页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有多个页面在导航时加载到div中,第1页内写的脚本与第2页中编写的脚本重叠。同样,在上一页中加载的脚本也会加载到当前页面中。我使用load()来加载一个html页面
$( document )。off(' click',' .areareClk');
$( document )。on(' 单击, .areareClk',函数(){
$( this )。addClass(' keyenable');
});
什么我试过了:
i试过
remove()
,
关闭(点击)
但未成功
解决方案
( document ).off(' 点击',' .areaClk');
( document )。 (' click',' .areareClk', function (){
( this )。addClass(' < span class =code-string> keyenable');
});
我尝试过:
i试过remove(),
off(click)但是没有成功
I have multiple pages that loads inside an div while navigate, the script written inside page 1 overlaps with the script written in page 2. Likewise the script that loaded in previous page also loads in the current page. I use load() to load an html page
$(document).off('click','.areaClk');
$(document).on('click','.areaClk',function(){
$(this).addClass('keyenable');
});
What I have tried:
i have tried
remove()
,
off(click)
but not succeed
解决方案
(document).off('click','.areaClk');
(document).on('click','.areaClk',function(){
(this).addClass('keyenable'); });
What I have tried:
i have triedremove(),
off(click)but not succeed
这篇关于在页面内写入的脚本会影响另一页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文