title: How to find and replace text in between two tags in HTML or XML document using jQuery?
body: <p>I want to find and replace text in a HTML document between, say inside the &lt;title&gt; tags. For example,</p>
  
  <pre><code>var str = "&lt;html&gt;&lt;head&gt;&lt;title&gt;Just a title&lt;/title&gt;&lt;/head&gt;&lt;body&gt;Do nothing&lt;/body&gt;&lt;/html&gt;";
  var newTitle = "Updated title information";
  </code></pre>
  
  <p>I tried using parseXML() in jQuery (example below), but it is not working:</p>
  
  <pre><code>var doc= $($.parseXML(str));
  doc.find('title').text(newTitle);
  str=doc.text();
  </code></pre>
  
  <p>Is there a different way to find and replace text inside HTML tags? Regex or may be using replaceWith() or something similar?</p>