Add bullet points jQuery

http://stackoverflow.com/questions/22814154/make-html-append-variable-with-jquery/22814295?noredirect=1#comment34795099_22814295

by csnsgiri

HTML

<textarea id="textarea"></textarea>
<br/>
<input type="button" id="getvalue" value="Send text" class="demobutton">
        
<div class="jcarouselbtext"  data-jcarousel="true">
    <ul  class="popupbtext">
        <li>
            <p >First bullet point</p>
        </li>
    </ul>
</div>
    
<script id="template3" type="text/template">
     <li>
         <p ></p>
     </li>
</script>

JavaScript

$(function(){
	$('#getvalue').click(function(){
        // Get the text area value
        var textarea_value = $('#textarea').val();               
        var templateHolder = $($('#template3').html());
        if(textarea_value!='')
        {
        		templateHolder.find('p').html(textarea_value);
        
        		// Get a reference to the <ul> element
						var $btext = $('.popupbtext');
        
        		// Add the template (with text area text) to the <ul> element
        		$btext.append(templateHolder);
        }
	});	
});