replace text with jquery code example
Example 1: jquery replace element
$("elementsSelector").replaceWith( "<h2>New content</h2>" );
Example 2: jquery replace text
$('#id1 p').each(function() {
var text = $(this).text();
$(this).text(text.replace('Kate', 'Nef'));
});
Example 3: jquery replace html
$(element).html("Hello World");
Example 4: jquery change text
$(yourElement).html("New text");
//sets yourElement innerHTML to "New text"
var text = $(yourElement).html();
//html() returns the text inside yourElement if you pass no parameters
Example 5: jquery replace text in div
$('#one span').text('Hi I am replace');
Example 6: replace jquery
$("p:first").replaceWith("Hello world!");