title: Using javascript to manipulate string into dom elements
body: <p>I have a string of text that is populated dynaimcally. In every string, there is one common word : "type". Given a string stored as a variable, I would like to use javascript to find the word "type" and place a dive before it, and then a closing div after the string. 
  Like so:</p>
  
  <pre><code>var string = "Here is some text that contains the word type and more text after";
  </code></pre>
  
  <p>I would like the end result to be like so:</p>
  
  <pre><code>Here is some text that contains the word &lt;div&gt;type and more text after&lt;/div&gt;
  </code></pre>
  
  <p>How can I go about this?</p>
  
  <p>Current Code is below:</p>
  
  <pre><code>var wod = $("#wod a").attr("title");
      var newwod = wod.replace("Copyright 2012, GB Blanchard - Learn Spanish: www.braser.com","");
      //get ride of example and everythign after it
      var finalwod = newwod.split("Example")[0];
      var newstring = finalwod.replace(/(type.+)/,"&lt;div&gt;$1&lt;/div&gt;");
  
  
     $("#wod span").append(newstring);
  </code></pre>