Rvervuurt
Rvervuurt

Reputation: 8963

Create a Stack Overflow-like form

I'm trying to create a form which prints the input directly beneath it, just like here on Stack Overflow when you write a question. However, since I'm new to Javascript and such, I don't know how to search for the correct function (I don't know the correct name for this technique).

Just a push in the right direction will already be a big help! Thanks!

enter image description here

Upvotes: 1

Views: 204

Answers (1)

Michael
Michael

Reputation: 4400

<!doctype html>
<html>
    <head>
    </head>
    <body>
        <script>
        function myFunction()
        {
            var input = document.getElementById('fname')
            var div = document.getElementById('text');
            div.innerHTML = escape(input.value);
        }
        </script>
        <input type="text" id="fname" onkeyup="myFunction()">
        <div id="text"></div>
    </body>
</html>

Upvotes: 2

Related Questions