'Insert information into a specific cell - Enable HTML code with checkboxes
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>
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alexander Ch |
