Javascript Append Textarea value issue -


i have created 4 textarea boxes , values when click submit button. when click submit button append text, written in textareas after submit button plain text. have tried createelement("p") , append values it's not working. here have done until now. can me find problem is?

thanks.

html code:

<div class="container">    <div class="content-container">     <label>first content<label>       <textarea id="fisrt-content" class="content-area" placeholder="insert content here"></textarea>       </div>        <div class="content-container">         <label>second content<label>       <textarea id="second-content" class="content-area" placeholder="insert content here"></textarea>       </div>        <div class="content-container">         <label>third content<label>       <textarea id="third-content" class="content-area" placeholder="insert content here"></textarea>       </div>        <div class="content-container">         <label>fourth content<label>       <textarea id="fourth-content" class="content-area" placeholder="insert content here"></textarea>       </div>         <button id="c-btn">submit</button>        <div id ="c-content"></div>   </div> 

javascript code:

var firstcontent = document.getelementbyid("first-content"); var secondcontent = document.getelementbyid("second-content"); var thirdcontent = document.getelementbyid("third-content"); var fourthcontent = document.getelementbyid("fourth-content"); var customcontainer = document.getelementbyid("c-content"); var submitbtn = document.getelementbyid("c-btn");   function submitcustomform() {    var celementone = document.createelement("p"); celementone = firstcontent.value; customcontainer.append(celementone);    var celementtwo = document.createelement("p"); celementtwo = secondcontent.value; customcontainer.append(celementtwo);    var celementthree = document.createelement("p"); celementthree = thirdcontent.value; customcontainer.append(celementthree);    var celementfour = document.createelement("p"); celementfour = fourthcontent.value; customcontainer.append(celementfour); }  submitbtn.addeventlistener("click", submitcustomform); 

celementone = firstcontent.value; - rewrites variable

try code

var celementone = document.createelement("p"); celementone.innertext = firstcontent.value; customcontainer.appendchild(celementone); 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -