Set the left border color of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:borderLeftColor

Description

Set the left border color of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="border-left:thick solid green">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Return left border color</button>

<script>
function myFunction() {/*  w w  w.ja  va  2 s .co  m*/
    document.getElementById("myDiv").style.borderLeftColor = "red";
}
</script>

</body>
</html>

Related Tutorials