title: Creating a HTMLdivElement object in Javascript
body: <p>Trying to turn a String into a HTMLDivElement object. I know how to create a string, I am just unsure how to create the HTMLDivElement. </p>
  
  <p>For example, if I wanted to turn <code>&lt;div id="cardId" class="card c9"&gt;&lt;/div&gt;</code></p>
  
  <p>It would also be good to really understand what a HTMLDivElementObject is too. </p>
  
  <p>EDIT: </p>
  
  <p>I also know that there are Universal Attributes such as id(string), style(object), title(string) and className(string).</p>
  
  <p>Below is my function and method. As you can see I try to create the <code>toElement</code> method. What I need is the method to return an HTMLDivElement object representing the Card. The example of what needs to be returned is as above <code>&lt;div id="cardId" class="card c9"&gt;&lt;/div&gt;</code>. </p>
  
  <pre><code>var cardProto = {
  // creates the HTML string representing this element
      "toString": function (){
          var s = this.card.getSuit(), r = this.card.getRank();
          var t = "&lt;div class=\"card ";
          t += s !== undefined ? s + r : "down";
          t += "\" id=\""+ this.id + "\"&gt;&lt;/div&gt;\n";
          return t;
      },
  
      "toElement": function () {
  
  
      }
  };
  </code></pre>