我在另一个程序员编写的代码中遇到了对jquery的hide()的奇怪调用:
$('#eventStartTimePickerButton, #eventEndTimePickerButton')._hide();_hide()和hide()在jQuery中有什么区别?
发布于 2015-07-15 21:48:16
_hide()变体在jQuery中不存在。最有可能的情况是隐藏的自定义扩展,如
(function ( $ ) {
$.fn._hide = function() {
//custom implementation
return this;
};
}( jQuery ));有关更多细节,请参见How to Create a Basic Plugin
更新
来自@Andreas的评论
此函数作为Widget Factories中基本小部件的一种方法存在。
所以,如果是这样的话,那么根据消息来源
this._hide( this.element, this.options.hide, function() {
// Remove the element from the DOM when it's fully hidden.
$( this ).remove();
});不同之处在于元素隐藏后被移除(随附动画)。
发布于 2015-07-15 21:47:56
函数_hide()既不是jQuery边缘的一部分,也不是jQuery compat边缘的一部分,它要么是在其他地方定义的函数,要么是插件添加的函数。
https://stackoverflow.com/questions/31441696
复制相似问题