title: How do I run the script automatically when the page loads?
body: <p>I have a script that outputs an alert if certain conditions are met (when entered directly into the browser console, it works). But <code>setTimeout()</code> or <code>window.onload</code> and <code>addEventListener</code> are not triggered. The code is located in the Google Chrome extension.</p>
  <pre><code>function Check_RM() {
      RM_number = $('#CasePageStnCaseNumberRMIntegerEdit-el').val()
      RM_number_full = RM_number.replace(/\s/g, '');
      check_length = new RegExp(&quot;[0-9]{6.6}+$&quot;).test(RM_number_full);
      check_number = new RegExp(&quot;[2,3,4]+$&quot;).test(RM_number_full);
      if (check_number) {
          alert('Заявка есть в Redmine');
      } else {
          console.log('Нет заявки')
      };
  }
  </code></pre>