JavaScript – Underline Text in Div

To underline text in div using JavaScript, get reference to the div 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 div using JavaScript.