JQuery替换全部字符

1 //JQuery替换全部字符
   <script>2 String.prototype.replaceAll = function (targetStr, newStr) {3 var sourceStr = this.valueOf();4 while (sourceStr.indexOf(targetStr) !== -1) {5 sourceStr = sourceStr.replace(targetStr, newStr);6 }7 return sourceStr;8 };9 </script>

 

相关文章