title: How do I know a div is display: none in two or more tabs of a browser?
body: <p>Consider I've this page: <strong>sample.php</strong></p>
  
  <pre><code>&lt;div id="id1" style="display: none"&gt;
  Hello
  &lt;/div&gt;
  </code></pre>
  
  <p>Initially when the page loads, this div is <strong>not</strong> displayed, but I've a <strong>button1</strong>. When I click on this button, it changes the display value to <strong>block</strong>.</p>
  
  <p>There's another <strong>button2</strong> that I use to change the display value back to <strong>none</strong>.</p>
  
  <p>So, this div is visible only when the <strong>button1</strong> is clicked. In other cases (when the page is reloaded or when <strong>button2</strong> is clicked), it would be invisible.</p>
  
  <p>Now, suppose that I've opened this same page in 4 more tabs (it can be even more, I'm giving just example) of a browser. And I've pressed <strong>button1</strong> in <strong>any 2</strong> of them. That means this div is visible in those <strong>2</strong> tabs.</p>
  
  <p>Now, what I want is that when the div is visible, the text inside it should store in a <strong>SESSION</strong> variable. And I can do it using JavaScript, jQuery, Ajax and PHP. When the <strong>two tabs</strong> have <strong>2 visible</strong> divs, their text "<strong>Hello</strong>" is stored in a same <strong>SESSION</strong> variable (it will store only "Hello" only, <strong>not "HelloHello"</strong> since SESSION will get replaced by new request as my Ajax and PHP code will run on all tabs at the same time).</p>
  
  <p>Now what I finally need is that when those <strong>2 visible</strong> divs in <strong>2</strong> differents tabs are set to <strong>display: none</strong>, it should unset the SESSION variable that has "Hello" in it.</p>
  
  <p>Because my condition for unsetting it is that none of the <strong>4</strong> tabs should have that div visible. If any of the tab has div visible, the SESSION would have "Hello" in it.</p>
  
  <p>PS: I've tried to explain a lot my problem, but still if you don't understand, please mention it in comment, before answering:</p>
  
  <p>Thank you.</p>