标签:
(function($) { Zepto.fn.clone = function() { var result = $.fn.clone.apply(this, arguments), oldTextareas = this.find(‘textarea‘).add(this.filter(‘textarea‘)), resultTextareas = result.find(‘textarea‘).add(result.filter(‘textarea‘)), oldSelects = this.find(‘select‘).add(this.filter(‘select‘)), resultSelects = result.find(‘select‘).add(result.filter(‘select‘)); for (var i = 0, l = oldTextareas.length; i < l; ++i) $(resultTextareas[i]).val($(oldTextareas[i]).val()); for (var i = 0, l = oldSelects.length; i < l; ++i) resultSelects[i].selectedIndex = oldSelects[i].selectedIndex; return result; }; })(Zepto);//clone时textarea和select的值丢失,zepto和jQuery都存在这个问题,解决办法是在clone的时候重新赋值
zepto的clone方法于textarea和select的bug修复
标签:
原文地址:http://www.cnblogs.com/Iona/p/5654256.html