在UpdatePanel中重新加载jquery插件 [英] Reload jquery plugin in UpdatePanel
问题描述
我有jquery插件,它适用于第一次页面加载。
i想要在更新面板中调用或重新加载
i能够在更新中加载其他jquery文件面板但无法加载jquery插件...
插件的起始代码语法
i have jquery plugin it work fine for first time page load.
i want to recall or reload it in update panel
i am able to load other jquery files in update panel but unable to load jquery plugin...
starting code syntax of plugin
(function($) {
//some futher functions
})(jQuery);
如何将它放在一个函数中,这样我就可以在更新面板中调用整个jquery函数了......就像这样在更新面板中
Sys.Application.add_load(重新加载);
i也在页面加载事件和更新面板onload上尝试此操作。
how do i put it in a function so i can call the whole jquery function in update panel???like this in update panel
Sys.Application.add_load(Reload);
i have also try this on page load event and update panel onload.
ClientScript.RegisterClientScriptInclude(this.GetType(), "myScript", "js/jquery.maskedinput.js");
Page.Header.Controls.Add(new LiteralControl("<script type='text/javascript' src='" + Page.ResolveUrl("js/jquery.maskedinput.js") + "'></script>"));
即使我试过它
Sys.Application.add_load(function(){所有插件脚本在这里}) ;
提前感谢
even i have try it
Sys.Application.add_load(function(){ all plugin script here});
thanks in advance
推荐答案
){
// 一些进一步的功能
})(jQuery);
) { //some futher functions })(jQuery);
我怎么做把它放在一个函数中,这样我就可以在更新面板中调用整个jquery函数了......就像这样在更新面板中
Sys.Application.add_load(重新加载);
i有也可以在页面加载事件和更新面板onload上试试这个。
how do i put it in a function so i can call the whole jquery function in update panel???like this in update panel
Sys.Application.add_load(Reload);
i have also try this on page load event and update panel onload.
ClientScript.RegisterClientScriptInclude(this.GetType(), "myScript", "js/jquery.maskedinput.js");
Page.Header.Controls.Add(new LiteralControl("<script type='text/javascript' src='" + Page.ResolveUrl("js/jquery.maskedinput.js") + "'></script>"));
即使我试过它
Sys.Application.add_load(function(){所有插件脚本在这里}) ;
提前感谢
even i have try it
Sys.Application.add_load(function(){ all plugin script here});
thanks in advance
我不知道您的方案的细节,所以我只能建议最通用的重装方式,这只会工作每次页面加载或重新加载DED。从
I don't know the detail of your scenario, so I can only suggest the most universal way of reloading, which would simply work every time your page is loaded or re-loaded. Call everything you want from the handler of
(document).ready 的处理程序中调用所需的一切。顺便说一下,这是使用jQuery和引导所有其他事件的预期方式。
这是如何: http://learn.jquery.com/about-jquery/how-jquery-works/ [ ^ ]。
当然,没有什么可以阻止你从JavaScript代码中的其他地方显式调用某些jQuery方法/属性,但是你需要了解应用程序的生命周期。使用JavaScript调试器可能会有很大的帮助。
-SA
(document).ready. By the way, this is an intended way of using jQuery and "bootstrapping" all other events.
This is how: http://learn.jquery.com/about-jquery/how-jquery-works/[^].
Of course, nothing prevents you from calling some jQuery methods/properties explicitly from other places in your JavaScript code, but you need to understand application lifetime. Using the JavaScript debugger could be a great help.
—SA
这篇关于在UpdatePanel中重新加载jquery插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!