title: How To Append <a></a> Tags To Specific Words In An Element With jQuery
body: <p>The tricky part is not selecting the elements here, but just selecting the text within. The only true jQuery that will give you back text contents is .contents(). So I'm getting the contents of every element not he page, and I want to pick out a word, such as "hashtag". Then append  to it.</p>
  
  <p>What am I doing wrong here:</p>
  
  <pre><code>&lt;html&gt;
  &lt;p&gt;
  The word hashtag is in this sentence.
  &lt;/p&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$(function() {
      $('*')
          .contents()
          .filter(function(){
              return this.nodeType === 3;
          })
          .filter(function(){
              return this.nodeValue.indexOf('hashtag') != -1;
          })
          .each(function(){
              alert("It works!")
          });
  });
  </code></pre>
  
  <p><code>$('*')</code> grabs every element</p>
  
  <p><code>.contents()</code> grabs the contents of every element</p>
  
  <p><code>.filter(function(){ return this.noteType === 3;</code> refines it down to the text contents of elements. (#3 node type is text)</p>
  
  <p><code>return this.nodeValue.indexOf('hashtag')</code> should grab the word "hashtag". Not sure if this is working.</p>
  
  <p><code>!= -1;</code> should prevent it from grabbing every single element in the HTML. Not sure about that one.</p>
  
  <p>Why doesn't it work? I know I have anything appending  tags yet, but  can I select the word "hashtag" thanks!</p>