Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're not entirely sure that the <code>id</code> numbers will decrease numerically, you could actively <em>test</em> for the format of the <code>id</code> (<code>A00</code>) <em>and</em> that the number is less-than <code>100</code>:</p> <pre><code>$('#main &gt; li').filter(function () { var id = this.id; return (/^A\d{2}$/).test(id) &amp;&amp; parseInt(id.replace(/[^0-9]/g, ''), 10) &lt; 99; }).each(function(){ // do whatever, for example: this.classList.add('selected'); }); </code></pre> <p><a href="http://jsfiddle.net/davidThomas/2bxaA/" rel="nofollow">JS Fiddle demo</a>.</p> <p>References:</p> <ul> <li>CSS: <ul> <li><a href="http://www.w3.org/TR/selectors/#child-combinators" rel="nofollow">Child (<code>E &gt; F</code>) combinator</a>.</li> </ul></li> <li>JavaScript/DOM: <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Element.classList" rel="nofollow"><code>Element.classList</code></a>.</li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp" rel="nofollow">JavaScript regular expressions</a>.</li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test?redirectlocale=en-US&amp;redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FRegExp%2Ftest" rel="nofollow"><code>RegExp.test()</code></a>.</li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt" rel="nofollow"><code>String.parseInt()</code></a>.</li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace" rel="nofollow"><code>String.replace()</code></a>.</li> </ul></li> <li>jQuery: <ul> <li><a href="http://api.jquery.com/filter/" rel="nofollow"><code>filter()</code></a>.</li> </ul></li> </ul>
    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.
 

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