jquery and classes
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 {}
});
精彩评论