you very welcome
here are the issue
-
if(customName.value !== '') what will happened if the user did not provide any data to the customName input ;)
-
you defined let newStory= storyText;
inside the if statment block that mean it does not exist outside that block
that why when you try to access it later it show it as undefined
go to the developer tool in your browser and check the console tab and you will see that it report it not defined
-
if(document.getElementById("uk").checked)
this will work in case if the user was in us then change it to uk but if the user decide later to change from the uk back to us it will still show the uk version
-
there 2 copy of “:insertx:” in the text so you need to replace both of them
you can use same replace(it replace the first occurrence only) method twice or check this one
try to fix those and if you find anything from the output that i missed try to fix it also
always check the console when use js code it help alot and you can use
console.log( write any value or string or variable here) and it will print it to the console so you maybe use it to check if the if condition work or the value of certain variable calculated as it should be
hope that help and have a nice day