title: How to append text to div
body: <p>Hi i have written this code to take 3 parameters and assign to variable.now i want to append the text i am getting throughparameter to div fontdiv 
  how to do this?</p>
  
  <p>here is what i have tried..</p>
  
  <pre><code>function getTextWidth(text, fontname, fontsize) {
      var elem = '&lt;div id="fontdiv" style="position: absolute;visibility: visible;height: auto;"&gt;&lt;/div&gt;';
      $('body').append($(elem));
      var fontdiv = document.getElementById('fontdiv');
      fontdiv.style.fontSize = fontsize;
      fontdiv.style.fontFamily = fontname;
      $("#fontdiv").html($('text').val());
      return fontdiv.clientWidth;
  };
  </code></pre>