My need at first seems basic, but I can not find a way to change the text inside a tag <span>
that is generated dynamically.
Below is the excerpt from the DOM where I have the following excerpt: <span>Novo Teste</span>
. I need to simply change the text contained within the tag, but without destroying the nested elements.
<li id="0"><span>Novo Teste</span><span class="acoes"> <a href="#" type="reset" class="btn btn-success edit-item" style="position: relative; top: -1px;"> <span class="entypo-pencil"> </span> Editar </a>
<a id="$('#destination-service-dropdown option:selected').text()" href="#" type="reset" class="btn btn-danger del-item" style="position: relative; top: -1px;"> <span class="entypo-cancel-squared"></span> Cancelar</a>
</span>
</li>
One unsuccessful attempt was this:
$("#"+idOfListItems+"").next().text($('#destination-service-dropdown option:selected').text());