Return the border-top property values of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:borderTop

Description

Return the border-top property values of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="border-top:5px solid red;">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Return top border</button>

<script>
function myFunction() {//ww  w . j  av a 2 s. co m
    console.log(document.getElementById("myDiv").style.borderTop);
}
</script>

</body>
</html>

Related Tutorials