I wonder if somebody can help me please. I’ve got this code, but it doesn’t work. I knw it’s stuck on the ‘$($newName).replaceWith(’<div…’ line but I don’t know how to fix it.
Thanks in advance
<script type="text/javascript">
$('#save').on('click', function(event) {
var $newName = $(this).attr('id');
$newName = $newName.replace("div_name","div_new_name");
$($newName).replaceWith('<div style="display: block;" id="'+ $newName +'">This is new div content</div>');
});
</script>