Q:

How to make each  have a checkbox (HTML & Javascript)

I'm creating a Chrome Extension that allows the user to create a todo list.  So far I am able to type in a task and submit it.  Now I want this input, which is a list, to have a checkbox.  Right now, whenever the user submits a task, it is counted as a list.
HTML:
<input type="text" name="newtask" value="" spellcheck="false" placeholder="New Task" id="newtask">
<ul id="tasksUL">
  <li><input type="checkbox"><label>test</label></li>
</ul>

Javascript:
$(() => {
   $('input').on('keypress', function(e) {
     if (e.keyCode == 13) {
       const newTask = $(this).val();
       if (newTask) {
         const li = document.createElement('li');
         li.textContent = newTask;
         $('#tasksUL').append(li);
         $(this).val("");
       }
     }
   });
 });

A:

try this...

$(() => {
  $('input').on('keypress', function(e) {
    if (e.keyCode == 13) {
      const newTask = $(this).val();
      if (newTask) {

        var li = $("<li><input type='checkbox'<label>" + newTask + "</label></li>");
        $('#tasksUL').append(li);
        $(this).val("");
      }
    }
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<input type="text" name="newtask" value="" spellcheck="false" placeholder="New Task" id="newtask">
<ul id="tasksUL">
  <li><input type="checkbox"><label>test</label></li>
</ul>

