我最近遇到了这个函数,我不确定前几行是做什么的。
有人可以向我解释一下吗?
干杯
jQuery.extend(jQuery.ui.dialog.prototype.options, {
create: function(event) { doSomthing(event); }
});
function doSomthing(event) {
STUFF
}
最佳答案
$.extend
是一个 jquery 函数,它将对象合并在一起,用较新的“版本”覆盖任何对象键。
// Will overwrite the name property. Output in this case is 'john'
// as it overwrites 'dave'
$.extend({name : "dave"}, {name : 'john'});
在您提供的示例代码中,$.extend
正在使用不同的函数覆盖 jQueryUI 对话框小部件中的原型(prototype)对象,从而改变“对话框”小部件在打开时的行为方式。创建。
关于jquery - 不确定这个 jQuery 函数是如何工作的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20044475/