How to get console inside jsfiddle

后端 未结 9 891
情深已故
情深已故 2020-12-04 09:37

How can I get the console to show in a fiddle on JSfiddle.com?

I recently saw a fiddle that had the console embedded in the fiddle, anyone know how this can be done?

相关标签:
9条回答
  • 2020-12-04 09:56

    I couldn't find any option for selecting the Firebug extension in the JavaScript gear option, and I didn't want to add external links/libraries, but there is another simple solution.

    You can use your browser's built in console

    0 讨论(0)
  • 2020-12-04 09:58

    None of the above solutions worked for me, since I needed an interactive console to be able to dynamically set a variable when testing reactivity in Vue.js.

    So I switched to Codepen, which has a an interactive console scoped to your application.

    0 讨论(0)
  • 2020-12-04 10:01

    I might be late to the party but just wanted to mention that JSfiddle has just released the new console feature. Just turn it on in the Settings if it doesn't work for you.

    Still in beta but hey... no more annoying workarounds.

    0 讨论(0)
  • 2020-12-04 10:05

    works fine... here

    var consoleLine = "<p class=\"console-line\"></p>";
    
    console = {
        log: function (text) {
            $("#console-log").append($(consoleLine).html(text));
        }
    };
    console.log("Hello Console")
    
    0 讨论(0)
  • 2020-12-04 10:05

    For future reference: the jsfiddle-console from answer was exactly what I needed when teaching a class on JavaScript. However I found it to be too limited to be of any actual use in this situation. So I made my own.

    Maybe it will serve anyone here.

    Just add the CDN-version to the resources of jsFiddle:

    https://unpkg.com/html-console-output
    

    Example here: https://jsfiddle.net/Brutac/e5nsp2mu/

    GitHub: https://github.com/karimayachi/html-console-output

    0 讨论(0)
  • 2020-12-04 10:07
    • click on that arrow next to JavaScript
    • and as FRAMEWORKS & EXTENSIONS select No-Libary (Pure JS)
    • paste your console.log('foo'); in JS box
    • under Resources add https://rawgit.com/eu81273/jsfiddle-console/master/console.js
      • or: under Resources add https://cdn.jsdelivr.net/gh/eu81273/jsfiddle-console/console.js
    • and run your script hitting that Play button

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