Javascript DOM CSS Style borderLeft Property get

Introduction

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

alert(document.getElementById("myDiv").style.borderLeft);

View in separate window

<!DOCTYPE html>
<html>
<body>

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

<p id="demo"></p>


<script>
function myFunction() {//from  w  ww  .ja  v a  2 s . c  o  m
  document.getElementById("demo").innerHTML = document.getElementById("myDiv").style.borderLeft;
}
</script>

</body>
</html>



PreviousNext

Related