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.
HTML
<div class='printchatbox'></div>
which is the empty box and
<input type='text' name='fname' class='chatinput'>
which is the input box.
CSS
.printchatbox
{border-width:thick 10px;border-style: solid;
background-color:#fff;
line-height: 2;color:#6E6A6B;font-size: 14pt;text-align:left;float: middle;
border: 3px solid #969293;width:40%;}
If anyone could tell me how to do this I would greatly appreciate it. Thanks
Angular JS does this in two lines of code :
Just import Angular JS as you import other libraries :
Then, on you first div (where you are copying from):
Then, on the place where you will show the content : just write :
This is the best solution I have ever found !
You use the
onkeyup
eventSearching with ids is a lot easier. Add ids to your elements as follows:
JS
Here is a Live example
http://jsfiddle.net/3kpay/
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
I've posted a working example here: http://jsbin.com/axibuw/1/edit
In your HTML,
In JS,
Click here for LIVE DEMO