Well, you don't, and normally shouldn't be trying to. console.log is not intended to display anything on the page, there are other ways for that. You'd have an element on the website and simply set its innerText property to the value you want it to display, something like document.getElemenetById("result").innerText = value. Answer from xroalx on reddit.com
🌐
W3Schools
w3schools.com › jsref › met_console_log.asp
JavaScript console.log() Method
❮ Previous ❮ Console Object Reference Next ❯ ... More examples below. The log() method writes (logs) a message to the console.
🌐
Reddit
reddit.com › r/learnjavascript › how to display the console.log result in html?
r/learnjavascript on Reddit: How to display the console.log result in HTML?
December 8, 2022 -

I want to create a simple input on the HTML and show the result to webpage.

for example if I type here it shows "asd"

But I want to display this in the html

If there is a way to save the result to some variable that would be great!

Thank you!

Discussions

Javascript: console.log to html - Stack Overflow
The idea is to post log messages and errors to HTML, for example if you need to debug JS and don't have access to the console. More on stackoverflow.com
🌐 stackoverflow.com
Print console.log on HTML [duplicate] - javascript
I've a javascript code that is currently working on a shared hosting. The script gather data from a website and then show it on my website. Fact is that the data is being showed in the console ta... More on stackoverflow.com
🌐 stackoverflow.com
[Javascript]How to print console.log in my HTML Document when opened in browser?
console.log only outputs to the browser console. If you want text to appear in in the browser, you'll need to use something like document.write() or, ideally, grab an element from your HTML and add text to it. More on reddit.com
🌐 r/learnprogramming
7
2
September 24, 2015
Show console.log() in an HTML element in JavaScript - Stack Overflow
I programmed a function, which writes all the stuff in the console (with console.log(string);). Now I want to "simulate" or show the generated console log in a or a . Does an... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › Alorel › console-log-html
GitHub - Alorel/console-log-html: Adds console log output to the screen · GitHub
<ul id="myULContainer"></ul> <!-- I will hold the log messages --> <script type="application/javascript" src="console-log-html.min.js"></script> <script> ConsoleLogHTML.connect(document.getElementById("myULContainer")); // Redirect log messages ConsoleLogHTML.disconnect(); // Stop redirecting </script>
Starred by 35 users
Forked by 12 users
Languages   CSS 95.4% | JavaScript 2.7% | HTML 1.9%
🌐
Codecademy
codecademy.com › forum_questions › 516026e513f70aa04d0029ad
How to show 'console.log's on a HTML page? | Codecademy
Stay tuned for more!"); } else { console.log("I slaved away at this game and you gave me that score?! The nerve! Just you wait!"); } </script> </head> <body alink="#EE0000" bgcolor="#66cccc" link="#0000EE" text="#000000" vlink="#551A8B"> <h1> <font color="#ffffff">MY FIRST GAME <br> </font></h1> <h1><font color="#ffffff">PRODUCED WITH JAVASCRIPT, <br> </font></h1> <h1><font color="#ffffff">ENJOY IT!</font></h1> </body> </html>
🌐
GeeksforGeeks
geeksforgeeks.org › html › html-dom-console-log-method
HTML DOM console log() Method - GeeksforGeeks
July 11, 2025 - ... <!DOCTYPE html> <html> <head> <title>DOM console.log() Method</title> </head> <body> <h1>GeeksforGeeks</h1> <h2> DOM console.log() Method </h2> <p> To view the message in the console press the F12 key on your keyboard.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › html-dom-console-log-method
HTML DOM console.log() Method
August 8, 2019 - Let us look at an example for the console.log() method − · <!DOCTYPE html> <html> <body> <h1>JavaScript console.log() Method</h1> <p>Press F12 key to view the message in the console view.</p> <button type="button" onclick="logConsole()">LOG</button> <script> function logConsole(){ ...
🌐
W3Schools
w3schools.com › js › js_output.asp
JavaScript Output
<!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <p>My first paragraph.</p> <script> alert(5 + 6); </script> </body> </html> Try it Yourself » · For debugging purposes, you can call the console.log() method in the browser to display data.
🌐
npm
npmjs.com › package › console-log-html
console-log-html - npm
September 26, 2016 - Copies/redirects console output to HTML. Latest version: 2.0.2, last published: 9 years ago. Start using console-log-html in your project by running `npm i console-log-html`. There are 6 other projects in the npm registry using console-log-html.
      » npm install console-log-html
    
Published   Sep 26, 2016
Version   2.0.2
Author   Alorel
🌐
KIRUPA
kirupa.com › html5 › console.htm
Console Logging Basics
This is no different than what we did with the alert statement earlier, and it is almost just as easy. The key to all of this is the Console API. This API contains a bunch of properties and methods that allow you to display things to your console in a variety of ways. The first and probably the most popular of these properties and methods is the log method.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-console-log-method
JavaScript console.log() Method | GeeksforGeeks
January 9, 2025 - The console.log() method in HTML is used for writing a message in the console. It indicates an important message during the testing of any program.
🌐
Reddit
reddit.com › r/learnprogramming › [javascript]how to print console.log in my html document when opened in browser?
r/learnprogramming on Reddit: [Javascript]How to print console.log in my HTML Document when opened in browser?
September 24, 2015 -

Hello everyone,

I've started with Javascript some days ago and learned some basic stuff at codeacademy. Now I've been at the part where I learned how to create a very simple Textadventure and I wanted to show that to my friend, by sending him a HTML Document (together with my JS Document) so the only thing he would had to do is to open it in Chrome or Firefox an "play" it.

Now I've added my JS to my HTML and all my prompt and confirm commands are shown perfectly, but everything I wrote in the console.log code just doesnt show up on my HTML-Doc when I open it in google chrome. Since I'm now a little into code I figured that you probably need a specific code to make the console.log messages be visible in your browser. I've searched google, but sadly I didn't find a clear answer. So I hoped that maybe one of you guys could help me.

So does anyone know what I have to do to make my console.log messages appear in my html document?

🌐
freeCodeCamp
freecodecamp.org › news › javascript-console-log-example-how-to-print-to-the-console-in-js
JavaScript Console.log() Example – How to Print to the Console in JS
November 12, 2024 - To do this, we use %c to specify that we have styles to add. The styles get passed into the second argument of the log. console.log("%c This is yellow text on a blue background.", "color:yellow; background-color:blue")
🌐
BitDegree
bitdegree.org › learn › javascript-console-log
Learn About JavaScript Console Log and How to Print in JavaScript
January 4, 2016 - Write into the output of HTML with document.write(). You can write into the JavaScript console of the browser with JavaScript console log method.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › console › log_static
console: log() static method - Web APIs | MDN
console.log(val1) console.log(val1, /* …, */ valN) console.log(msg) console.log(msg, subst1, /* …, */ substN)
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › console
console - Web APIs - MDN Web Docs
Outputs a message to the console with the debug log level. ... Displays an interactive listing of the properties of a specified JavaScript object. This listing lets you use disclosure triangles to examine the contents of child objects. ... Displays an XML/HTML Element representation of the ...
🌐
CodeSandbox
codesandbox.io › examples › package › console-log-html
console-log-html examples - CodeSandbox
Use this online console-log-html playground to view and fork console-log-html example apps and templates on CodeSandbox.