Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Not selector causes infinite loop
    primarykey
    data
    text
    <p>The following code causes my browsers to crash. For Firefox, i've been given an option whether or not i want to stop jQuery because it was running longer than it should be. </p> <pre><code>div id="divLeaving"&gt; You are about to leave to: &lt;span id="spanLeavingURL"&gt;&lt;/span&gt; &lt;a id="divLeavingYes" href="#"&gt;Yes&lt;/a&gt;&lt;a id="divLeavingNo" href="#"&gt;No&lt;/a&gt; &lt;/div&gt; &lt;a href="http://www.google.com"&gt;google&lt;/a&gt; &lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function() { $("a:not(#divLeavingYes, #divLeavingNo)").click(function() { var url = $(this).attr("href"); var test_if_local = url.indexOf("mycompany.com"); if (test_if_local == -1) { $("#spanLeavingURL").text(url); $("#divLeavingYes").attr("href", url); $("#divLeavingNo").click(function() { $(this).dialog('destroy'); }); $("#divLeaving").dialog({ modal: true }); return false; } }); }); &lt;/script&gt; </code></pre> <p>However, if i remove the not selector it doesn't crash my browser.</p> <pre><code>&lt;div id="divLeaving"&gt; You are about to leave to: &lt;span id="spanLeavingURL"&gt;&lt;/span&gt; &lt;a id="divLeavingYes" href="#"&gt;Yes&lt;/a&gt;&lt;a id="divLeavingNo" href="#"&gt;No&lt;/a&gt; &lt;/div&gt; &lt;a href="http://www.google.com"&gt;google&lt;/a&gt; &lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function() { $("a").click(function() { var url = $(this).attr("href"); var test_if_local = url.indexOf("mycompany.com"); if (test_if_local == -1) { $("#spanLeavingURL").text(url); $("#divLeavingYes").attr("href", url); $("#divLeavingNo").click(function() { $(this).dialog('destroy'); }); $("#divLeaving").dialog({ modal: true }); return false; } }); }); &lt;/script&gt; </code></pre> <p>How do i change thes query so it selects all except for #divLeavingYes and #divLeavingNo?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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