Solution 1 :

Call value property instead of innerHTML:

document.getElementById(myEditableDIVInputArea_Id).value = myRawInnerHTMLVal;

Solution 2 :

It’s because you’re not calling the function and you’re not awaiting it (it’s async), in this case you don’t need it to be async.

var myRawInnerHTMLVal = (revVarArgs) => {
    let myWidgetView = '<div class="flexContainerClass">HELLO WORLD</div>';

    return myWidgetView;
};

module.exports.myRawInnerHTMLVal = myRawInnerHTMLVal;
document.getElementById(myEditableDIVInputArea_Id).innerHTML = myRawInnerHTMLVal(args);

Problem :

I have been trying to output raw HTML inside an editable DIV, but the <div> get commented out.

This is what I am trying to output :

var myRawInnerHTMLVal = async (revVarArgs) => {
    let myWidgetView = '<div class="flexContainerClass">HELLO WORLD</div>';

    return myWidgetView;
};

module.exports.myRawInnerHTMLVal = myRawInnerHTMLVal;

this is what I get instead (Please NOTE HELLO WORLD is not wrapped inside a div) :

var myRawInnerHTMLVal = async (revVarArgs) => {
    let myWidgetView = 'HELLO WORLD';

    return myWidgetView;
};

module.exports.myRawInnerHTMLVal = myRawInnerHTMLVal;

THE CALL

document.getElementById(myEditableDIVInputArea_Id).innerHTML = `
    var myRawInnerHTMLVal = async (revVarArgs) => {
        let myWidgetView = '<div class="flexContainerClass">HELLO WORLD</div>';

        return myWidgetView;
    };

    module.exports.myRawInnerHTMLVal = myRawInnerHTMLVal;
`;

How can I get the raw HTML output?

Thank you all in advance.

Comments

Comment posted by Chamara Abeysekara

so, what you are trying is to show some code in div right? why don’t you show it as text ?

Comment posted by Nilanshu96

The

Comment posted by Program-Me-Rev

Thank you for the response, but I am trying to print out the whole

Comment posted by Bitrey

I’m not sure if I understood correctly, but if you want to append the HTML instead of replacing it then you could use the shorthand

By