当我查看http://docs.jquery.com/Plugins/Authoring时,我无法理解语法。需要JQuery语法解释,可能与选择器相关联
其实我成立了一个类似的脚本在的jsfiddle:http://jsfiddle.net/huyoumo/HUc2L/24/
下面的代码片段:
var methods = {
init : function(options) {
return this.each(function(){
var $this = $(this),
data = $this.data('tooltip'),
tooltip = $('<div />', {
text : $this.attr('title')
});
// If the plugin hasn't been initialized yet
if (! data) {
/*
Do more setup stuff here
*/
$(this).data('tooltip', {
target : $this,
tooltip : tooltip
});
}
});
},
更具体:
tooltip = $('<div />', {
text : $this.attr('title')
});
我调试的代码,并找出工具提示是一个JQuery对象(显然),它只有一个孩子(一个HTMLDivElement)。
我试图谷歌JQuery选择器作为关键词,但没有运气。任何人都可以摆脱光线并解释它的作用吗?
谢谢。
又摸
谢谢,这正是我所追求的。只是不太确定我需要搜索什么关键词。感谢您的时间和精力,帮助我摆脱薄雾:D – DavidH
没问题:)! – bang