在jquery中我使用这样的替换
replace('old text','new text')
如何使用纯 JavaScript 做同样的事情?
最佳答案
那是纯Javascript。请参阅here.
var str = "Visit Microsoft!";
var res = str.replace("Microsoft", "W3Schools");
关于javascript - 纯 JavaScript 等价于 jquery Replace(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6854559/