Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p><em>"where myValue which is an int is greater or lower than a given value"</em></p> </blockquote> <p>The following hides all the child elements that have <code>class3</code> text that is a number greater than that specified in <code>val</code>:</p> <pre><code>// hide elements containing a number greater than val var val = 20; $(".parent .child").show().filter(function () { var n = $(this).find(".class3").text(); return +n &gt; val; }).hide(); </code></pre> <p>Demo: <a href="http://jsfiddle.net/zLHJd/" rel="nofollow">http://jsfiddle.net/zLHJd/</a></p> <p>This finds all the <code>.child</code> elements, makes them all visible initially, then filters the list back to just those with an appropriate value and hides those. The key difference compared with the code in the question is that you have to use <code>.find()</code> (or some other DOM traversal method) to check only the <code>class3</code> element for the <em>current</em> <code>child</code> element in the loop or filter.</p> <p>The above doesn't test explicitly for an <em>int,</em> but will only hide those with a numeric value greater than <code>val</code> because the unary plus operator returns <code>NaN</code> if the value isn't a number, and <code>NaN &gt; val</code> will always be <code>false</code>. If you actually want to test for an int such that numbers with decimal places are ignored (their divs not hidden), you could do this:</p> <pre><code> return !/\D/.test(n) &amp;&amp; +n &gt; val; </code></pre> <p>That is, test that there are no non-digit characters in the div before testing it against <code>val</code>.</p>
    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. 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