Deprecated: Function create_function() is deprecated in /www/wwwroot/www.woniu.wang/usr/plugins/AntiSpam/Plugin.php on line 75
快速技巧:解析jQuery - 文本 - 蜗牛工作室_刘永个人博客

快速技巧:解析jQuery - 文本

发布于 / 知识文档 / 0条评论 / Tags: none / 8 次浏览

  快速技巧:解析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 );
}

  登录后复制

  请记住,只有 1.4 或更高版本的用户才能将函数传递给 text() 方法。但这没问题;如果您仍在使用 1.3,您真的应该停止使用! :)

  “剖析 jQuery”系列中的其他章节 过滤器 格列普

  快速技巧:解析jQuery - 文本的详细内容,更多请关注红帽云邮其它相关文章!

    评论区(暂无评论)