码迷,mamicode.com
首页 > 其他好文 > 详细

jq封装方法步骤

时间:2016-12-04 00:38:57      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:asc   compile   mpi   class   jquer   lan   封装   方法   var   

例子如下:

(function($) { var compiled = {}; $.fn.handlebars = function(template, data) { if (template instanceof jQuery) { template = $(template).html(); } compiled[template] = Handlebars.compile(template); this.html(compiled[template](data)); }; })(jQuery); $(‘#content‘).handlebars($(‘#template‘), { name: "Alan" });

jq封装方法步骤

标签:asc   compile   mpi   class   jquer   lan   封装   方法   var   

原文地址:http://www.cnblogs.com/chenyangsuaige/p/6129830.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!