This is the current legacy code
$('#container input[type="number"], #container input[type="text"]').replaceWith(function () {
return $(`<p class="readonly" id="${$(this).prop('id')}">${$(this).val()}</p>`).append($(this).contents());
});
I need to do some clean-up and refactoring and was hoping to modernize this but replaceWith doesn't seem to have an argument I can use to substitute for 'this' in the places where we're using it like $(this).prop. I thought it should be event.currentTarget but that didn't work (or maybe my implementation was wrong)