jQuery find and replace string

前端 未结 6 956
天命终不由人
天命终不由人 2020-11-28 22:37

I have somewhere on website a specific text, let\'s say \"lollypops\", and I want to replace all the occurrences of this string with \"marshmellows\". The problem is that I

6条回答
  •  庸人自扰
    2020-11-28 23:23

    var string ='my string'
    var new_string = string.replace('string','new string');
    alert(string);
    alert(new_string);
    

提交回复
热议问题