Creating div and seeing real time text?
Hello,
I'm trying to create a div ( which works ) and then add text to it in real time ( which doesn't ).
my code:
- // this part works.
- $("#AddText").click(function() {
- if (!$('#TextArea').length){
- $("#Area").append("<div id='TextArea'>test</div>");
- }
- });
- // however this isn't working, I can't seem to figure out why.
- $("#AddText").keypress(function() {
- if ($('#TextArea').length){
- $("#TextArea").val(this.value);
- }
- });
any help would be great.
thanks!