nonstop328 nonstop328 - 10 months ago 28
Javascript Question

get value from textarea and create a new textarea with the text

Now i have a problem with the get value ~ I was doing a function which is when i click a button it will show up a modal and inside it have a textarea. once you write all the content inside, click ok button it will create a new textarea with the text you wrote. You can do it multiple time.i only know how to add a new textarea but i have no idea how to get the value.i have a hard time with this function~ hope anyone can help me. i am a newbie in this area. Sorry about my bad grammar.



var counter=1;

$('.add').click(function() {

$('.block:last').before('<div class="block">'+



<link rel="stylesheet" href="">

<script src=""></script>

<script src=""></script>

<div class="block">
<button type="button" class="btn btn-default btn-lg start-new-post-button-setting" data-toggle="modal" data-target="#codetextarea">Add code textarea</button>
<div class="modal fade" id="codetextarea" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<textarea class=" textarea-setting" name="message" id="area"></textarea>
<div class="modal-footer">
<span class="add"><button type="button" class="btn btn-default" data-dismiss="modal">OK</button></span>




This is how you get the value of the textarea. Replace your '<textarea></textarea>'+ with above