I'm confused why the onclick function doesn't register the first time it is clicked. Each div with the onclick trigger has to be clicked twice the first time.

```js
function selected(elmnt) {
  if (elmnt.style.backgroundColor == "transparent")
    elmnt.style.backgroundColor = "#990000"
  else
    elmnt.style.backgroundColor = "transparent"
}
```

```css
#container {
  background-color: transparent;
  height: 100px;
  width: 100px;
}
```

```html
<div id="container" onclick="selected(this)">click me</div>
```

Am I missing something here?