How to call .getContent and .parseContent from bootstrap-markdown.js

前端 未结 3 1460
醉话见心
醉话见心 2021-02-07 04:04

I\'m a newbie when it comes to using Bootstrap plugins (just learned about it via codecademy)... I really would like to use this awesome bootstrap markdown plugin but fail to pr

3条回答
  •  遥遥无期
    2021-02-07 04:27

    e represent the markdown edit only inside the onSave function.

    So you have to get the markdown instance, I checked the plugin and it's possible (hacky but possible :-)

    If you want to access it inside your post click function you have to access it in this way:

    • get the markdown element
    • get the markdown instance via data('markdown')
    • use the parseContent function

    Code:

    $(".btn-post").click(function (e) {
        post = $('.status-box').data('markdown').parseContent();
        console.log(post)
    });
    

    Demo: http://jsfiddle.net/IrvinDominin/fdpM4/

提交回复
热议问题