I would really appreciate your help here. I want list item that is created with the "#save" button to be removed on click. The commented methods don't work. If i put 'h1' or something else it works no problem. Also the "#delBtn" button removes all list items no problem. But i cant;t make it work when i click on a list item to be removed. Thanks for your time in advance.
function Contact(first, last) {
  this.firstName = first;
  this.lastName = last;
}
$(document).ready(function() {
  let a_contacts = [];
    $("#delBtn").click(function(){
      $("li").remove();
    });
    $("#save").click(function(){
      event.preventDefault()
      var inputtedFirstName = $("input#new-first-name").val();
      var inputtedLastName = $("input#new-last-name").val();
      var newContact = new Contact(inputtedFirstName, inputtedLastName);
      $("ul#contacts").append("<li class='contact'>" +'First Name: '+ newContact.firstName + ' Last Name: '+ newContact.lastName + "</li>");
      a_contacts.push(newContact);
      $("input#new-first-name").val("");
      $("input#new-last-name").val("");
    });
        //---------------------------------------------------------------
      // $("li").click(function() { 
      //   $(this).remove();
      //  });
      //   $('li').click(function(e){
      //     $(e.target).remove();
      // });
});
<!DOCTYPE html>
<html>
  <head>
    <link href="CSS/bootstrap.css" rel="stylesheet" type="text/css">
    <link href="CSS/style.css" rel="stylesheet" type="text/css">
    <script src="JS/jquery-3.2.1.js"></script>
    <script src="JS/myjava.js"></script>
    <title>Address book</title>
  </head>
  <body>
    <div class="container">
      <h1 id="haha" >Address book</h1>
      <div class="row">
        <div class="col-md-6">
          <h2>Add a contact:</h2>
          <form id="new-contact"><!-- form -->
            <div class="form-group">
              <label for="new-first-name">First name</label>
              <input type="text" class="form-control" id="new-first-name">
            </div>
            <div class="form-group">
              <label for="new-last-name">Last name</label>
              <input type="text" class="form-control" id="new-last-name">
            </div>
            <button id="delBtn" class="btn">Add</button>
            <button id="save"  class="btn">Save</button>
          </form><!-- form -->
          <h2>Contacts:</h2>
          <ul id="contacts">
          </ul>
        </div>
        <div class="col-md-6">
          <div id="show-contact">
            <h2></h2>
            <p>First name: <span class="first-name"></span></p>
            <p>Last name: <span class="last-name"></span></p>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
 
     
     
    