+ 1
How to link button with js variable
i want to make a button that give a print of a js variable string
2 Answers
+ 2
A print? Like in the console or onto your site?
0
create a p element somewhere with display: none; and button should have onclick="functionName()"
after that js code should look like this:
function functionName(){
var t = document.getElementById("yourId");
var text = "your text";
t.style.display = block;
t.innerHTML = text;
}