Change the outline style of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:outlineStyle

Description

Change the outline style of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {/*from w  ww  . ja v a  2 s.c om*/
    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>

Related Tutorials