标签:style blog color io for cti html ar
$.fn.combineInput = function (_config) { var _config = $.extend({ addStr: "" }); var td = $(this); var input = td.find("input"); var inputLength = input.length; var _temp = []; var _tempStr = ‘‘; var pack = { init: function () { for (var i = 0; i < inputLength; i++) { _temp[i] = input.eq(i).val(); } return pack.combine(); }, combine: function () { _tempStr = _temp.join(_config.addStr); return _tempStr; } }; return pack.init(); } //拆分字符串填入输入框 $.fn.splitInput = function (value) { var _temp = []; for (var i = 0; i < value.length; i = i + 4) { _temp.push(value.substring(i, i + 4)); } var td = $(this); var input = td.find("input"); var inputLength = input.length; for (i = 0; i < inputLength; i++) { input.eq(i).val(_temp[i]); } return _temp; }
html
<div id="test">
几个<input>
</div>
引用
$("#test").combineInput()
jquery拼接和拆分字符串,并加入特殊符号,布布扣,bubuko.com
标签:style blog color io for cti html ar
原文地址:http://www.cnblogs.com/ysf123/p/3879974.html