Frage

I am creating a firebug extension. I need to display json in the panel, I am using textarea to display panel but it doesn't work, extension simply crashes. I tried this:

var template = domplate(
        { 

                tag:
                TEXTAREA({"class": "textEditorInner", type: "text"},json)
        });

but the plugin crashes, it works for normal text however.

War es hilfreich?

Lösung

Note that your json variable should contain a string with backslash escaped quotes when passing it to the template.

Other solution would be to first render your template

var textarea = template.render();

and then add the content afterwards via

textarea.value = json;

Of course you'll then need to remove the json from your template.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top