sceditor how to parse bbcode back to html?

287 views Asked by At

I'm having the same issue as this user here. I can't comment on the post and it's been almost 6 years since the post. The only answer is this:

var val = $('textarea').sceditor('instance').val();
var result = $('textarea').sceditor('instance').fromBBCode(val, true);
//result = html code

But unfortunately, it doesn't work. Here is the documentation on val(), I've looked through examples, but I just can't find the solution. I believe it should be simple for someone who's not a complete newbie to all of this. I'm getting spoiled with all the fast answers to my previous questions so thanks in advance! Long live stack overflow

EDIT: I would also like to know where am I supposed to put the emoticons folder because it doesn't work from the root folder

EDIT 2: use emoticonsRoot: to declare the root folder of emoticons. You can find more about it here

1

There are 1 answers

0
live627 On

This is the updated code for SCEditor v2.1.3 (also v3.0.0)

        var parser = sceditor.instance(document.getElementById('example'));
        console.log(parser.fromBBCode(parser.val(), true));