While typing in a text input field, printing the content typed in a div

前端 未结 5 2097
时光取名叫无心
时光取名叫无心 2020-12-13 03:08

I have a website where there is a empty box and a input text box. I want to be able to type something in that input box and have it be printed on the empty box.

HTM

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 03:34

    In your HTML,


    In JS,

    function annotate(){
      var typed= document.getElementById("fname").value;
      document.getElementById("printchatbox").innerHTML= typed;
    }
    

    Click here for LIVE DEMO

提交回复
热议问题