Javascript DOM CSS Style outlineStyle Property set

Introduction

Change the outline style of a <div> element:

document.getElementById("myDiv").style.outlineStyle = "solid";

View in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {//from w w  w . j av  a  2 s .c o  m
  border: 1px solid red;
  outline: green dotted thick;
}
</style>
</head>
<body>

<div id="myDiv">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Change outline style</button>

<script>
function myFunction() {
  document.getElementById("myDiv").style.outlineStyle = "solid";
}
</script>

</body>
</html>



PreviousNext

Related