jQuery删除JavaScript代码 [英] jquery remove javascript code
本文介绍了jQuery删除JavaScript代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我能够使用$(element).remove();
使用jquery删除html元素.但是有一个JavaScript代码,例如setinterval()
,应将其删除.是的,我可以针对特定情况进行clearInterval()
,但是如果其他类型的javascript代码呢?
I am able to remove html element using jquery using $(element).remove();
. But there is a javascript code, like setinterval()
, which should be removed. Yes, I can do clearInterval()
for particular that case, but what if other types of javascript code?
<script>
var baseurl = '...';
jQuery(function(){
new AjaxUpload('#upload_button', {
action: baseurl,
onSubmit : function(file , ext){
jQuery('#...').val(file);
},
onComplete: function(file, response){
// do something....;
}
});
});
</script>
但是我不能这样做.
有人可以帮我解决这个问题吗?
Can anybody help me out this problem?
推荐答案
为您的脚本设置一个ID,
set a id to your script,
<script id="sample">
...
</script>
并使用此代码,
$("#sample").remove();
这篇关于jQuery删除JavaScript代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文