title: Transform input back into a div on button click
body: <p>I am using the following code</p>
  
  <pre><code> $(document).on('click', '#editDetailBtn', function () {
  
      var input = $('&lt;input id="#detailprimaryDescription" type="text" /&gt;');
      input.val($('#detailprimaryDescription').text());
      $('#detailprimaryDescription').replaceWith(input);
  
  
      $('#editDetailBtn').hide();
      $('#detailPrimaryCancel').show();
      $('#detailPrimarySave').show();
  
  });
  
  
  $(document).on('click', '#detailPrimaryCancel', function () {
  
  
      var input = $('&lt;div id="#detailprimaryDescription" &gt;&lt;/div&gt;');
      //input.val($('#detailprimaryDescription').text());
      $('#detailprimaryDescription').replaceWith(input);
  
  
          $('#editDetailBtn').show();
          $('#detailPrimaryCancel').hide();
          $('#detailPrimarySave').hide();
  
  });
  </code></pre>
  
  <p>what I am trying to achieve is to once cancel is clicked then it will turne the input field back into a div </p>
  
  <p><a href="http://jsfiddle.net/7XWAu/" rel="nofollow">http://jsfiddle.net/7XWAu/</a></p>