want to replace the text inside span of parent div

jquery

Solution

You probably want

$('#testId').parent().find('.comments-title').text('something else');

Problem

I have my html structure like ``` <div> <div class="comments-title-wr clearFix"> <span id="commentsSize" class="comments-title">Some Text</span> </div> <div id="testId"> </div> </div> ``` I can retrieve `testId` and using this I want to replace text inside `<span>` tag. I tried using ``` $('#testId').parent().closest('.comments-title').text().replace('something else'); ``` but it's not working

Original source