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

前端 未结 5 2086
时光取名叫无心
时光取名叫无心 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:40

    There are many ways to get this done, possibly the easiest is to use jQuery. In the example below I am using the jQuery keyUp() function to listen for keyboard events, then writing the updated value to the .printChatBox

    
    
    
    
    
    
    
      
    CHANGE ME

    I've posted a working example here: http://jsbin.com/axibuw/1/edit

提交回复
热议问题