How to store an HTML element's value to a JS variable?

Hi guys,

As the title suggests.
Below is what I did, and what I get printed on the console. Any suggestions?

The HTML bit

    <p id="stuff">Stuff to store in a JS var</p>
  <script src="sw.js"></script>

The JS bit

let htmlTxt = document.getElementById("stuff").value;

What it prints on the console

I’d appreciate your help very much.
Thank you!

use textContent:

.value is for value of <input> I think.

1 Like

Thank you!
I finally got my StopWatch to display lapses of time.