JavaScript – Change the Border of Div

To change the border of a div using JavaScript, get reference to the element, and assign required value to the element.style.border property.

Example

Conclusion

In this JavaScript Tutorial, we learned how to change the border of a div using JavaScript.