How would I alter the following line to change all instances of the string "OldName" to "NewName" inside of a targeted td? Right now it only changes the first instance and then stops.

Code:
    tdText.html(tdText.html().replace(OldName, NewName));
For reference purposes below is the code that line came from

Code:
       var OldName = $('[id^=ImageName]').val(),
            NewName = $('[id^=NewName]').val(),
            tdText = $("." + DataKey).parent();
            NewName = data["itemName"];
       subOld = OldName.split('.');
       subNew = NewName.split('.');
       NewName = subNew[0] + "." + subOld[1];
       tdText.html(tdText.html().replace(OldName, NewName));