title: jQuery replace text using replaceText and variable
body: <p>i tried to implement replaceText jQuery plugin from <a href="http://benalman.com/projects/jquery-replacetext-plugin/" rel="nofollow">http://benalman.com/projects/jquery-replacetext-plugin/</a></p>
  
  <p>But nothing happens when the code is executed.</p>
  
  <p>Thanks for any clues.
  Sincerely
  Marek  </p>
  
  <pre><code>/**
   * jQuery Plugin replaceText
   **/
  
  (function($){  
  $.fn.replaceText=function(b,a,c){  
      return this.each(function(){  
          var f=this.firstChild,g,e,d=[];  
          if(f){  
              do{  
                  if(f.nodeType===3){  
                      g=f.nodeValue;  
                      e=g.replace(b,a);  
                      if(e!==g){  
                          if(!c&amp;&amp;/&lt;/.test(e)){  
                              $(f).before(e);  
                              d.push(f)  
                          }else{  
                              f.nodeValue=e  
                          }  
                      }  
                  }  
              }while(f=f.nextSibling)  
          }  
          d.length&amp;&amp;$(d).remove()  
      })  
  }  
  })(jQuery);  
  
  /**
   * variable containing content of q variable from google referer
   **/
  
  var querywords = "Some+text+from+google%20referer";
  
  /**
   * function for replace each word from body with its "marked" version
   * that is after handled by css propetry for "mark" element
   **/
  
  $(document).ready(function ( ) {
  if(window.querywords !== undefined){
      var qw = window.querywords.replace('%20','+');
      qw = qw.replace(' ','+');
      var splited = qw.split("+");
      for(var q in splited){
          $('body :not(textarea)').replaceText( /\bsplited[q]\b/gi, '&lt;mark&gt;$1&lt;/mark&gt;');
      }
  }
  });
  </code></pre>