Onchange is giving me "on" for the value of the event?

I have a function that fires when onchange happens. However event.target.value shows that “on” is the value. I am trying to have an object update with a checked mark show up when the box is checked.

<script type="text/javascript">

let lizt = {
            "learn": {
              "react": true,
              "python": false,
              "nodejs": false


let lixxt = lizt["learn"];
let order = document.getElementById("order")

let status = lizt["learn"] ? '' : 'checked';

for (stuff in lixxt){

let status = !lixxt[stuff] ? '' : 'checked';
order.innerHTML += '<li>' + '<input type="checkbox"+ '  + status +  '>' + stuff + '</li>'


order.onchange = markit;

function markit(){
  let key = event.target.value;

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


What does you html look like?


See above, where I explain how to format your code so that it is readable.


```<div id="div">
```  <ol id="order">

```  </ol>

You need to be looking at the checked attribute.

function markit() {
  let key = event.target.checked;
  console.log(key); // true or false

aaaannnnd. you sir just made my night better! Greetings Randell from Randall.