JavaScript – Underline Text in Paragraph

To underline text in paragraph using JavaScript, get the reference to the paragraph element, and assign element.style.textDecoration property with value of "underline".

Example

Conclusion

In this JavaScript Tutorial, we learned how to underline text in a paragraph using JavaScript.