JavaScript Empty value displayed for div background color

HTMLElement.style will get only inline styles (<div style="color: blue;">).

The backgroundColor in your element comes from its class (I guess), not an inline style.

To get the currently applied/computed style, you have to use window.getComputedStyle:

var element = document.getElementById('blueDiv');
var pre = document.getElementById('style');
pre.innerHTML = 'Its background color is: ' + window.getComputedStyle(element).getPropertyValue("background-color");
.blue{
  background-color: blue;
  padding: 5px;
  font-family: sans-serif;
  font-weight: bold;
  font-size: 20px;
  color: white;
}
<div id="blueDiv" class="blue">
  I'm blue da bu dee da bu die
</div>

<pre id="style"></pre>
Answer:1

I was searching an issue about a delay in my Pomodoro clock (FreeCodeCamp project) that I discovered when I noticed my test session of one minute should have been done by now. I checked back and it ...

I was searching an issue about a delay in my Pomodoro clock (FreeCodeCamp project) that I discovered when I noticed my test session of one minute should have been done by now. I checked back and it ...

Hya, I have the below setup: App.Component.Ts contents carForm: FormGroup; constructor( private fb: FormBuilder ) { this.carForm= this.fb.group({ name: '', type: '', ...

Hya, I have the below setup: App.Component.Ts contents carForm: FormGroup; constructor( private fb: FormBuilder ) { this.carForm= this.fb.group({ name: '', type: '', ...

I'm using a generated library (LoopBack's Angular SDK) for my model's CRUD operations, and finding it difficult to unit test controllers and services that make use of them. Here's an example where I'...

I'm using a generated library (LoopBack's Angular SDK) for my model's CRUD operations, and finding it difficult to unit test controllers and services that make use of them. Here's an example where I'...

  1. unit test promise
  2. unit test promise reject
  3. unit test promise.all
  4. unit test promise resolve
  5. unit test promise angular
  6. unit test promise angular 2
  7. unit test promise jest
  8. unit test promise mocha
  9. unit test promise jasmine
  10. unit test promise chain
  11. unit test promise catch
  12. unit test promise then
  13. unit test promise javascript
  14. unit test promise node.js
  15. unit test promise java
  16. unit test promise sinon
  17. node js unit test promises
  18. unit test promise example
  19. unit test promise method
  20. angular unit test promise then

Does anyone know how to handle the connected, disconnected, reconnecting and etc on Laravel Echo? I'm using VueJS btw

Does anyone know how to handle the connected, disconnected, reconnecting and etc on Laravel Echo? I'm using VueJS btw