+ 1

How to link button with js variable

i want to make a button that give a print of a js variable string

19th Feb 2018, 12:33 PM
Anil Raj
Anil Raj - avatar
2 odpowiedzi
+ 2
A print? Like in the console or onto your site?
19th Feb 2018, 12:53 PM
Jonas Schröter
Jonas Schröter - avatar
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; }
19th Feb 2018, 1:25 PM
Ice
Ice - avatar