Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<div id="msgtxttt" style="width:200px;background-color:silver;height:200px;"></div>
</br>
<input id="msgtxt" type="text" /></br>

  <span id="searchbtn" style="cursor:pointer;" onclick="send();">Send</span>

    <script type="text/javascript">

    function send(){

        var txt = $.trim($('#msgtxt').val());
        var box = $("#msgtxttt").html();
        if(box!=""){
        $("#msgtxttt").html(box +"<br />" +txt);
        }
        else
         $("#msgtxttt").html(txt);
        $('#msgtxt').val("");
    }

</script>
Posted

1 solution

I think you are looking for this

http://jsfiddle.net/apw8xsmk/[^]

JavaScript
$(document).ready(function(){

    $('#searchbtn').click(function(){
        var txt = $.trim($('#msgtxt').val());

        var box = $("#msgtxttt").html();
        if(box!=""){
        $("#msgtxttt").html(txt +"<br />" +box);
        }
        else
         $("#msgtxttt").html(txt);
        $('#msgtxt').val("");
    })

});



If not? Reply... :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900