Insert information into a specific cell - Enable HTML code with checkboxes

Viewed 14

I need to run a code in HTML with checkboxes when the user triggers a specific cell, but i don't know how to do.

function onEdit(){}
<html>
    <head>   
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"></head>
 <body>
  <div class="container">
   <p>
     <label>
        <input type="checkbox" id="Obj" value="A&E"/>
        <span>A&E</span>
      </label>
    </p>
  </div>
    <div class="input-field col s12">
   <button class="btn waves-effect waves-light" id="btn">Adicionar
    <i class="material-icons right">send</i>
  </button>
  </div>
</div>
  </div>   
 <!-- Compiled and minified JavaScript -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
     <script> 

1 Answers

you can add a event listener in the checkbox:

checkbox = document.getElementById("Obj").addEventListener("click",onEdit)

The addEventListener() method attaches an event handler to the specified element.

Related