i have a text area where i put my code and below div that shows a preview about the user are typing in the text area the problem it’s that if the user press the enter key i lose the value. How can i pass this value???. Or am i doing wrong my method
the html
<textarea id="txtMessageFields"></textarea>
<div id="messagePreview"></div>
the js
$(document).ready(initialize);
function initialize(){
$messageValues = $("#messagePreview");
$("#txtMessageFields").keyup(previewData);
}
function previewData() {
$messageValues.html('');
var aux = this.value;
$messageValues.append('<p>' + aux + '</p>');
}
I did small change to your code is this what you need?
http://jsfiddle.net/hfV7y/