alter text() not html()

alter text() not html()

hey guys i have a scenario like so:

  1. <div id="test-value" class="selected-option"><div class="remove"></div></div>
  1. $(document).ready(function() {
        $('#test-value').text('123');

        console.log($('#test-value').html());
    });
  2. // returns: 123

how it it possible for me to add text to #test-value selector without removing the <div class="remove"></div> already inside?

suppose i could do:

  1. $('#test-value').text('123<div class="remove"></div> ');


but is there a proper way of altering the text but not the html (in this scenario) without messing around with the div wrapping


thank you