Created
August 22, 2019 17:36
-
-
Save parzibyte/363b12eea85495c84cf49ce9355f0b60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// El td del botón | |
let $tdBoton = document.createElement("td"); | |
let $boton = document.createElement("button"); | |
// dataset solo permite guardar cadenas, por eso codificamos como JSON | |
$boton.dataset.producto = JSON.stringify(producto); | |
$boton.textContent = "Acción"; | |
// En el click llamamos a la función definida anteriormente | |
$boton.addEventListener("click", accionProducto); | |
$tdBoton.appendChild($boton); | |
$tr.appendChild($tdBoton); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment