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

前端 未结 3 1461
醉话见心
醉话见心 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/

    0 讨论(0)
  • 2021-02-07 04:27

    Change path of these js file

    <script src="js/markdown.js"></script>
    <script src="js/to-markdown.js"></script>
    

    To

    <script src="js/vendor/markdown.js"></script>
    <script src="js/vendor/to-markdown.js"></script>
    

    Hope this will help you...

    0 讨论(0)
  • 2021-02-07 04:39

    Have you download bootstrap - markdown.js file into your work environment. Check The link of bootstrap - markdown.js file. The lib of markdown.js may be missing in your code.

    UPDATE

    HI @Norfeldt,

    For This you have to follow Below Instructions.

    1. Check Compatibility versions between bootstrap.min.css and bootstrap.min.js.(i.e you must maintain same versions for both the things.) Because http://s3.amazonaws.com/codecademy-content/courses/ltp2/css/bootstrap.min.css Link contains Bootstrap version 3.0 css and http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js Link contains Bootstrap 2.3.2 version JS.

    2.Maintain Correct root Directory path.

    <script src="js/markdown.js"></script>
    <script src="js/to-markdown.js"></script>
    <script src="js/bootstrap-markdown.js"></script> 
    

    must be

    <script src="js/vendor/markdown.js"></script>
    <script src="js/vendor/to-markdown.js"></script>
    <script src="js/vendor/bootstrap-markdown.js"></script>
    

    3. Which version of bootstrap-markdown.js lib you are using.

    Check this one

    Version                       Compatibility with Bootstrap
    Bootstrap Markdown v2.x      only compatible with Bootstrap 3.x
    Bootstrap Markdown v1.x      only compatible with Bootstrap 2.x
    

    Note: Download bootstrap files from Here add add to your html file.

    0 讨论(0)
提交回复
热议问题