JavaScript – Change the Top Border of HTML Element
To change the top border of a HTML Element using JavaScript, get reference to this HTML element, and assign required value to the element.style.borderTop
property.
In the following example, we will change the top border of HTML Element with id "myElement"
to "2px dotted red"
, in JavaScript, using element.style.borderTop
property.
Example
ADVERTISEMENT
Conclusion
In this JavaScript Tutorial, we learned how to change the top border of a HTML Element using JavaScript.