title: How to remain the previous text box value on button click
body: <p>Hello Friends
  I am facing some problem or can say not figure out any help regard this so please help me
  There is button having name Add Text when I click that button it display a text box when i enter some text in this text box it display the entered text below.when I click again Add Text button  then previous one textbox seems empty i don't want this. </p>
  
  <p>1.) My requirement is when I click Add Text button second time it doesn't empty the previous textbox.</p>
  
  <p>2.) when i click the B button then it convert the text to bold.Right now its working for one text i want when i select particular text and click B button it convert the particular selected text to bold. 
  These are my two problem.Please reply if anybody having the solution of my problem.
  Thanks</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
     var i=0;
     function add_input()
          {
            if(i!=6){
                var d=document.getElementById('div');
  
             d.innerHTML+="&lt;input type='text'  name='addtext"+i+"' id='addtext"+i+"'onkeyup='copy("+i+")'&gt;&lt;br&gt;&lt;/br&gt;";
                   i++;
                   }
  
          }
    function copy(j){
  
             var mm = 'addtext'+j;
             var divid = 'newcontent'+j;
             var s1=document.getElementById(mm).value;
  
             /*var s2=document.getElementById('newcontent'+j);*/
             var s2=document.getElementById('newcontent'+j);
  
             s2.innerHTML=s1;
  
  
              }
            &lt;/script&gt;
  
  
        &lt;script type="text/javascript"&gt;
            function f2() {
  
                 if(document.getElementById('newcontent0').style.fontWeight =='bold')
                      {
                           document.getElementById('newcontent0').style.fontWeight = 'normal';
                      }
                     else if(document.getElementById('newcontent0').style.fontWeight =='normal')
                       {
                          document.getElementById('newcontent0').style.fontWeight = 'bold';
                        }
                    else if(document.getElementById('newcontent0').style.fontWeight =='')
                       {
                          document.getElementById('newcontent0').style.fontWeight = 'bold';
                        }
                }
               &lt;/script&gt;
  
       &lt;input  type="button" value="Add Text" onclick="add_input()"  /&gt;
       &lt;input type="button"  value="B"  onclick="f2()"/&gt; 
       &lt;div id="div"&gt;&lt;/div&gt;
       &lt;div id="newcontent0"  style="padding:0px;margin:0px;"&gt;&lt;/div&gt;
       &lt;div id="newcontent1"  style="padding:0px;margin:0px;"&gt;&lt;/div&gt;
       &lt;div id="newcontent2"  style="padding:0px;margin:0px;"&gt;&lt;/div&gt;
       &lt;div id="newcontent3"  style="padding:0px;margin:0px;"&gt;&lt;/div&gt;
       &lt;div id="newcontent4"  style="padding:0px;margin:0px;"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Thanks </p>