Answers for "how to replace string jquery"

3

jquery replace text

$('#id1 p').each(function() {
    var text = $(this).text();
    $(this).text(text.replace('Kate', 'Nef')); 
});
Posted by: Guest on January-09-2021
16

js replace all

function replaceAll(str, find, replace) {
    var escapedFind=find.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
    return str.replace(new RegExp(escapedFind, 'g'), replace);
}
//usage example
var sentence="How many shots did Bill take last night? That Bill is so crazy!";
var blameSusan=replaceAll(sentence,"Bill","Susan");
Posted by: Guest on July-22-2019
6

replace all javascript

str.split(search).join(replacement);
Posted by: Guest on May-01-2020
0

replace jquery

$("p:first").replaceWith("Hello world!");
Posted by: Guest on April-27-2021

Code answers related to "how to replace string jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language