“Agregar botón para agregar el elemento JavaScript” Código de respuesta

JavaScript Agregar botón a Div

// get the element you want to add the button to
var myDiv = document.getElementById("demo");

// create the button object and add the text to it
var button = document.createElement("BUTTON");
button.innerHTML = "Button";

// add the button to the div
myDiv.appendChild(button);
Rubahn Die U-Bahn

Agregar botón para agregar el elemento JavaScript


<script>
    function addItem(){
        var li = document.createElement("LI");  
        var input = document.getElementById("add");
        li.innerHTML = input.value;
        input.value = "";

        document.getElementById("faves").appendChild(li);
    }
</script>

<input type="button" id="btnAdd" value="Add" onclick="addItem()">

Nasty Newt

Agregar botón para agregar el elemento JavaScript

2






Different Dragonfly

Respuestas similares a “Agregar botón para agregar el elemento JavaScript”

Preguntas similares a “Agregar botón para agregar el elemento JavaScript”

Más respuestas relacionadas con “Agregar botón para agregar el elemento JavaScript” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código