Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get the value of a style of an element in javascript

to get a property value of an element in js :

html:
<div class="element" style="color: red;">Red hot chili pepper!</div>

js:
const your_element = document.querySelector('.element')
const color_of_my_element = your_element.style.color
console.log(color_of_my_element) // red
Source by zellwk.com #
 
PREVIOUS NEXT
Tagged: #style #element #javascript
ADD COMMENT
Topic
Name
8+7 =