title: Check to see if div is present with jquery
body: <pre><code>if(.is-open close-now){
  jQuery(".extra_div").click(function($){
              alert('"Sorry, this takeaway only accepts orders during its opening hours"');
          });
  }
  </code></pre>
  
  <p>I think something like the above is what I need but I don't know how the if statement part should work out.</p>
  
  <p>I'm looking to check if a certain div is present and then if it is, run the following jQuery on click code.</p>
  
  <p><strong>Update 1</strong></p>
  
  <pre><code>if ($(.is-open close-now).length){
  jQuery(".extra_div").click(function($){
              alert('"Sorry, this takeaway only accepts orders during its opening hours"');
          });
  }
  </code></pre>
  
  <p>The two divs are </p>
  
  <p>is-open open-now - open
  .is-open close-now - closed</p>