Good afternoon, in line with this topic - https: //en.stackoverflow.com/questions/203969/replicate-control-of-val-em-span I have the following code
$('textarea.skills_knowledge').blur(function() {
var skills_knowledge = $(this).val();
$('span.skills_knowledge').html(skills_knowledge); });
I would like to know how to preserve the line breaks, ie if you hit the enter in the text area, appear this in the span properly one below the other
I do not know if it is the best format, I accept suggestions for improvement, but I found this format in topic -https: //en.stackoverflow.com/questions/40803/use-of-val-no-script-me-do-lead-shocks of-line? rq = 1
$('textarea.skills_knowledge').blur(function() {
var skills_knowledge = $(this).val();
var skills_knowledge = skills_knowledge.replace(/\r?\n/g, '<br />');
$('span.skills_knowledge').html(skills_knowledge); });