
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to set outline color with JavaScript?
To set outline color, use the outlineColor property in JavaScript. You can try to run the following code to learn how to implement outlineColor property −
Example
Live Demo<!DOCTYPE html> <html> <head> <style> #box { border: 2px solid red; } </style> </head> <body> <div id = "box"> Demo Content </div> <br> <button type = "button" onclick = "display()">Change outline color</button> <script> function display() { document.getElementById("box").style.outlineColor = "#FF5733"; document.getElementById("box").style.outline = "2px solid"; } </script> </body> </html>
- Related Articles
- How to set the color of the outline around an element with JavaScript?
- Set the color of the outline with CSS
- How to set all outline properties in a single declaration with JavaScript?
- How to set all the outline properties in one declaration with JavaScript?
- How to set the width of the outline around an element with JavaScript?
- How to set the style of the outline around an element with JavaScript?
- How to set the color of the top border with JavaScript?
- How to set the color of an elements border with JavaScript?
- How to set the color of the right border with JavaScript?
- How to set the color of the text-decoration with JavaScript?
- How to set the color of the left border with JavaScript?
- CSS outline-color property
- Animate CSS outline-color
- How to set the color of the rule between columns with JavaScript?
- Set outline style as ridge with CSS

Advertisements