title: Javascript returning Uncaught TypeError: Cannot call method 'indexOf' of undefined
body: <p>I have a facebook friend invite sender and the following code is returning and error.</p>
  
  <pre><code>iframeHTML = $myjq('#polldaddy_embed_0').html();
                            if (iframeHTML.indexOf("facebook") === -1) {
                                iframeHTML = iframeHTML.replace("fb_id=","fb_id="+window.uid);
                                iframeHTML = iframeHTML.replace("?q_3826051_url=","&amp;q_3826051_url="+encodeURIComponent(window.url));
                                $myjq('#polldaddy_embed_0').html(iframeHTML);
                            if (window.total&gt;=5) {
                                 $myjq('#fb_first5_id').trigger('click');
                            }
                         }
  </code></pre>
  
  <p>The error which I am getting is:</p>
  
  <p>Uncaught TypeError: Cannot call method 'indexOf' of undefined</p>