I have build a live code editor but it is not showing output in the iframe and it is saying undefined please help me | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

I have build a live code editor but it is not showing output in the iframe and it is saying undefined please help me

https://code.sololearn.com/Wdo0v1XXCN73/?ref=app

2nd Jul 2022, 1:27 PM
Saddam Hussain
Saddam Hussain - avatar
3 Respostas
+ 4
You need to change JS code like below. let editor = ace.edit("editor", { theme: "ace/theme/cobalt", mode: "ace/mode/html", autoScrollEditorIntoView: true, enableBasicAutocompletion: true, enableSnippets: true, enableLiveAutocompletion: true, }); function live() { document.getElementById("viewer").srcdoc =editor.getValue(); }
2nd Jul 2022, 3:24 PM
Oleh Davydenko
Oleh Davydenko - avatar
+ 2
L1c Bot Use innerHTML because you are getting value from html element not from input box var editor = document.getElementById("editor").innerHTML
2nd Jul 2022, 1:51 PM
AĶ¢J
AĶ¢J - avatar
+ 2
Thanks to AĶ¢J , Oleh Davydenko for your help it is now working šŸ˜ŠšŸ˜ŠšŸ˜‰
3rd Jul 2022, 4:01 AM
Saddam Hussain
Saddam Hussain - avatar