开发者

jquery and classes

开发者 https://www.devze.com 2023-04-10 05:21 出处:网络
I have 2 classes: $.widget(\'blueimp.fileupload\', { a: function{} }) $.widget(\'blueimpUI.fileupload\', $.开发者_JAVA百科blueimp.fileupload, {

I have 2 classes:

$.widget('blueimp.fileupload', {
    a: function  {}
})

$.widget('blueimpUI.fileupload', $.开发者_JAVA百科blueimp.fileupload, {
    b: function  {}
})

I want to replace my first two functions with a single class.

Function b works but function a doesn't. Why?

$.widget('blueimpUI.fileupload', $.blueimpUI.fileupload, {
    a: function  {},
    b: function  {}
})


It's not quite clear what you're trying to do but I believe the $.widget method takes two arguments as explained in this documentation:

jquery.ui.widget.js provides a factory method to create widget classes. The signature is $.widget(String name, Options prototype)

Therefore, the code with function b probably does not work due to incorrect syntax.


Something like this might work better:

$.widget('blueimpUI.fileupload', {
    fileupload: $.blueimp.fileupload, 
    a: function  {},
    b: function  {}
});
0

精彩评论

暂无评论...
验证码 换一张
取 消