JavaScript – Change the Right Border of HTML Element

To change the right border of a HTML Element using JavaScript, get reference to this HTML element, and assign required value to the element.style.borderRight property.

Example

In the following example, we will change the right border of HTML Element with id "myElement" to "2px dotted red", in JavaScript, using element.style.borderRight property.

index.html

ADVERTISEMENT

Conclusion

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