Get the outline border color of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:outlineColor

Description

Get the outline border color of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {/*w w w .  j  a v a2  s.  co m*/
    border: 1px solid red;
    outline-style: dotted;
}
</style>
</head>
<body>

<div id="myDiv" style="outline-color:blue;">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Return outline color</button>

<script>
function myFunction() {
    console.log(document.getElementById("myDiv").style.outlineColor);
}
</script>

</body>
</html>

Related Tutorials