建站学院

当前位置:

快速技巧:解析jQuery - 文本

浏览量:311次

快速技巧:解析jquery - 文本

在最新一集中的“剖析 jQuery”中,我们将讨论 text() 方法,以及 jQuery 1.4 中您可能还不知道的一项新功能。

高级会员:下载此视频(必须登录)

订阅我们的 YouTube 页面以观看所有视频教程!

text 方法的 jQuery 源代码

text: function( text ) {
		if ( jQuery.isFunction(text) ) {
			return this.each(function(i) {
				var self = jQuery(this);
				self.text( text.call(this, i, self.text()) );
			});
		}

		if ( typeof text !== "object" && text !== undefined ) {
			return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
		}

		return jQuery.text( this );
	}
登录后复制

[声明]本网转载网络媒体稿件是为了传播更多的信息,此类稿件不代表本网观点,本网不承担此类稿件侵权行为的连带责任。故此,如果您发现本网站的内容侵犯了您的版权,请您的相关内容发至此邮箱【915688610@qq.com】,我们在确认后,会立即删除,保证您的版权。