+ 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
3 Réponses
+ 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();
}
+ 2
L1c Bot
Use innerHTML because you are getting value from html element not from input box
var editor = document.getElementById("editor").innerHTML
+ 2
Thanks to A͢J , Oleh Davydenko for your help it is now working 😊😊😉