Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If your selector returns 0 elements then it could not be located in the DOM.</p> <pre><code>if( $('#cookies_notification').length === 0 ) { // Do something } </code></pre> <p>Here is a working example: <a href="http://jsfiddle.net/LT7g8/" rel="nofollow noreferrer">http://jsfiddle.net/LT7g8/</a></p> <p>Alternatively, see this question: <a href="https://stackoverflow.com/questions/31044">Is there an “exists” function for jQuery?</a></p> <p>If you are simply wondering whether the object is hidden (and not completely absent from the DOM), check out the <a href="http://api.jquery.com/hidden-selector/" rel="nofollow noreferrer">jQuery <code>:hidden</code> selector</a>. If the element exists but has been hidden, this selector will return the element. It will not select the element if it does not exist, nor if it does exist and is visible.</p> <p>For your situation it sounds like you want to detect first if the element exists, and then detect whether it has been hidden by <code>SlideUp()</code>.</p> <pre class="lang-js prettyprint-override"><code>var objCookieNotification = $('#cookies_notification'); if ( objCookieNotification.length === 0 ) { // Notification does not exist in the DOM. // Add it to the DOM here. } else if ( objCookieNotification.is(':hidden') ) { // Notification exists in the DOM but is hidden. // Make it visible again here. } else { // The notification exists in the DOM and is already visible. // If you need to make it flash or something, you can do that here. } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload