In this plunk I have a div
that contains some text and a span
, also with text.
My objective is to change the text of the div
, without changing the text of the span
.
I tried with jQuery but the problem is that the entire div
text changes, replacing also the span
text, any ideas?
HTML
<div id="id1">some text to change <span>THIS TEXT STAYS</span></div>
Javascript:
$( document ).ready(function() {
var id1 = $("#id1");
id1.text("New Text");
});