1
I’m trying to make a code that reads a string from Console
browser and assign the string value in id "txtTextoResposta"
.
To make it more illustrated, I want to make it similar to C#, when we do like this:
string x = Console.ReadLine();
I tried with the ReadLine()
, but it didn’t work:
var x = readline();
document.getElementById("txtTextoResposta").innerHTML = x;
I also tried with the Console.Log
, but it returns an error:
var x = console.log;
document.getElementById("txtTextoResposta").innerHTML = x;
Error:
Function log() { [Native code] }
What I’m doing is not for a website. It’s kind of a code to paste into the console and run it right there. In this case it wouldn’t work either?
– Francisco
@Francisco can put code to run on the page, but you can’t read lines that have been written on the console.
– Sergio