I have a textarea with a button, the content of this textarea inserts in a <p> when i click submit button, but when i click submit 2 or more times with another text in the textarea, the new text REPLACES old text in the older <p> makes before. I don't want to do this, i want to make new p with the new text of textarea without replacing the old text in the old p tags with the new text. Each p inserts in a carrousel, but it's doesn't matter.
This is my code:
The initial p:
<div class="jcarouselbtext" data-jcarousel="true">
<ul class="popupbtext">
<li><p class="info1">oLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p></li>
</ul>
</div>
The textarea with the button:
<textarea id="textarea"></textarea>
<input type="button" id="getvalue" value="Enviar texto" class="demobutton">
The javascript code:
$(function () {
$('#getvalue').click(function(){
var textarea_value = $('#textarea').val();
$('.show-textarea-value').html(textarea_value);
var $btext = $('.popupbtext');
var template = $('#template3').html();
$btext.append(template);
$('.jcarouselbtext').jcarousel('reload', {
animation: 'slow'
});
});
});
The script template for the new p tags:
<script id="template3" type="text/template">
<li><p class="info1 show-textarea-value"></p></li>
</script>