The accepted answer is close... but no cigar!
Use textContent
instead of innerHTML
if you strictly want a string to be returned to you.
innerHTML
can have the side effect of giving you a node element if there's other dom elements in there. textContent
will guard against this possibility.