Check if the webpage has been modified
<p>I am working on chrome extension for facebook. If you use facebook, you know that when you scroll down to the bottom of the news feed/timeline/profile it shows more posts. The extension actually adds a button beside the "like" button. So I need to check if there are more posts to add that button to.</p>

<p>Right now to check if the page has been modified, I use <code>setInterval(function(){},2000)</code>.
I want to run a function when the user clicks the button. But this function doesn't work if I put it outside (or even inside) setInterval() – The Koder just now edit </p>

<p>How can I check if the webpage has been modified WITHOUT using a loop?</p>

<p>Example:</p>

<pre><code>$(document).ready(function(){
    window.setInterval(function(){
          $(".UIActionLinks").find(".dot").css('display','none');
          $(".UIActionLinks").find(".taheles_link").css('display','none');
          $(".miniActionList").find(".dot").css('display','none');
          $(".miniActionList").find(".taheles_link").css('display','none');
              //only this function doesn't work:
          $(".taheles_link").click(function(){
            $(".taheles_default_message").hide();
            $(".taheles_saving_message").show();
          });
               //end
          $(".like_link").after('&lt;span class="dot"&gt; · &lt;/span&gt;&lt;button class="taheles_link stat_elem as_link" title="תגיד תכל&amp;acute;ס" type="submit" name="taheles" onclick="apply_taheles()" data-ft="{&amp;quot;tn&amp;quot;:&amp;quot;&amp;gt;&amp;quot;,&amp;quot;type&amp;quot;:22}"&gt;&lt;span class="taheles_default_message"&gt;תכל&amp;acute;ס&lt;/span&gt;&lt;span class="taheles_saving_message"&gt;לא תכלס&lt;/span&gt;&lt;/button&gt;');
          $(".taheles_saving_message").hide();
    }, 2000);
});
</code></pre>

<p>In the future, this extension will use AJAX, so <code>setInterval()</code> can make even more problems for me.</p>
