码迷,mamicode.com
首页 > Web开发 > 详细

JQuery替换全部字符

时间:2018-12-27 12:04:14      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:function   his   ace   prot   class   turn   eal   var   news   

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>

 

JQuery替换全部字符

标签:function   his   ace   prot   class   turn   eal   var   news   

原文地址:https://www.cnblogs.com/xiaoyongjun/p/10184040.html

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