Try to use val() instead of text():
<script type="text/javascript">
$(document).ready(function(){
$("#Send").click(function(){
var tx=$("#ChtInput").val();
$("#ChtShow").append("<br/><br/>"+tx);
});
});
</script>
Pregunta
I use this code for a kinda a chat.
<script type="text/javascript">
$(document).ready(function(){
$("#Send").click(function(){
var tx=$("#ChtInput").text();
$("#ChtShow").append("<br/><br/>"+tx);
});
});
</script>
#Send is a button,
#ChtInput is the text area from where you're introducing text
And when #Send is clicked, post the text into the #ChtShow div.
It works fine in IE, but in Chrome and Firefox it append just <br/><br/>
tags
I made it work doing that:
<script type="text/javascript">
var tx=$("#ChtInput").text();
$(document).ready(function(){
$("#Send").click(function(){
$("#ChtShow").append("<br/><br/>"+tx);
});
});
But this way work only if i put some text between the textarea tags, but it show only the text between the texarea tags instead of what i write in the textarea.
Sorry for my english...I hope you understand :D
Solución
Try to use val() instead of text():
<script type="text/javascript">
$(document).ready(function(){
$("#Send").click(function(){
var tx=$("#ChtInput").val();
$("#ChtShow").append("<br/><br/>"+tx);
});
});
</script>