How to make input content appear in the alert?

0

No JavaScript:

    function myFunction (){

        var input = document.querySelector('.inputt');
        var text = document.createTextNode('');
        b_i.innerHTML = textt;

        alert(textt);
    }

HTML :

   <input class='inputt'/>
   <button onclick='myFunction'></button>
    
asked by anonymous 27.07.2018 / 05:08

1 answer

2

HTML

<input type="text" id="inputId">
<input type="submit" value="Enviar" onclick="MyFunction()">

JS

function MyFunction(){
    var id = document.getElementById("inputId").value;
    alert(id);
}
    
27.07.2018 / 05:34