小编Mit*_*ath的帖子

@Component弹簧注释标准范围

springs @Component注释的默认范围是什么?

如果您根本不定义范围,那么它是应用程序范围的吗?Spring文档没有说明默认范围。

java spring

7
推荐指数
1
解决办法
8480
查看次数

如何在jquery插件中添加try catch块

我有一个jQuery插件.我想在我的jQuery插件中添加try catch块以进行异常处理.

我的插件

$(document).ready(function(){
$('.requiredclass').keyup(function() {


$(this).pluginMethod();

});
});

(function($) {  //i Want try catch block for this part

// jQuery plugin definition

$.fn.pluginMethod = function(e) {

       return this.each(function() {
       var $this = $.this; 
       var som= $this.val();

            //My Code goes here  

        });
};

})(jQuery);
Run Code Online (Sandbox Code Playgroud)

现在,如果我想添加try catch块,那么插件的外观如何?在jquery函数的情况下我们做这样的事情

功能

function myFunction() {
//varible declarations
try { 
    //Code goes here
}
catch(err) {  //We can also throw from try block and catch it here
    alert("err");
}
finally {
    //code for finally block
} …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-plugins

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×1

javascript ×1

jquery ×1

jquery-plugins ×1

spring ×1