3 Star 0 Fork 0

Gitee 极速下载/Populate-jq

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/e-sites/populate
克隆/下载
jquery.populate.min.js 879 Bytes
一键复制 编辑 原始数据 按行查看 历史
(function(c){c.fn.extend({populate:function(b,g){function f(a){return h.replace("{key}",a.key).replace("{value}",a.value)}var i={select:null,exclude:null,opPopulate:null},h='<option value="{key}">{value}</option>',j=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,d=[],e;if(b instanceof Object)for(e in b)b.hasOwnProperty(e)&&d.push(f({key:e,value:b[e]}));else b.constructor===String&&""!==b&&(j.test(b)?d=b:c.map(b.split("&"),function(a){d.push(f({key:a.split("=")[0],value:a.split("=")[1].replace("+"," ")}))}));
return this.each(function(){var a=c.extend(i,g),b=c(this);"SELECT"===this.nodeName&&(b.find(a.exclude?"option:not("+a.exclude+")":"option").remove().end().append(d).removeAttr("disabled"),null!==a.select&&c(this.options).removeAttr("selected").filter(a.select).attr("selected","selected"),a.onPopulate&&c.isFunction(a.onPopulate)&&a.onPopulate.apply(this,[d]))})}})})(jQuery);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mirrors/Populate-jq.git
git@gitee.com:mirrors/Populate-jq.git
mirrors
Populate-jq
Populate-jq
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385