jQuery show elements with a range of values
<p>I'm trying to get jQuery to show/hide elements based on the value of an attribute between two values.  </p>

<p>I have markup that looks like this:</p>

<pre><code>&lt;a class="page_link" href="javascript:go_to_page(0)" longdesc="0"&gt;1&lt;/a&gt;
&lt;a class="page_link" href="javascript:go_to_page(1)" longdesc="1"&gt;2&lt;/a&gt;
&lt;a class="page_link" href="javascript:go_to_page(2)" longdesc="2"&gt;3&lt;/a&gt;
&lt;a class="page_link" href="javascript:go_to_page(3)" longdesc="3"&gt;4&lt;/a&gt;
&lt;a class="page_link active_page" href="javascript:go_to_page(4)" longdesc="4"&gt;5&lt;/a&gt;
&lt;a class="page_link" href="javascript:go_to_page(5)" longdesc="5"&gt;6&lt;/a&gt;
&lt;a class="page_link" href="javascript:go_to_page(6)" longdesc="6"&gt;7&lt;/a&gt;
&lt;a class="page_link" href="javascript:go_to_page(7)" longdesc="7"&gt;8&lt;/a&gt;
&lt;a class="page_link" href="javascript:go_to_page(8)" longdesc="8"&gt;9&lt;/a&gt;
</code></pre>

<p>I have some jQuery that looks like this:</p>

<pre><code>//Now, we need to paginate the pagination
var page_link_count = $('.page_link').length(); 

//Hide all the .page_links
$('.page_link').css('display','none'); 

//Show active_page
$('.active_page').css('display','block'); 

//Show up to four .page_link on either side of active_page
var active_page_value = $('.active_page').attr('longdesc'); 

$('.page_link').each(function(){

    var longdesc = $(this).attr('longdesc');

    // This next part might be what's getting me...
    if( longdesc &lt;= active_page_value+4 &amp;&amp; longdesc &gt;= active_page_value-4){

        $(this).css('display','block');

    }

});
</code></pre>

<p>I'm trying to say, if the longdesc attribute value of any element with a page_link class is greater than the value of the sum of the active_page longdesc - 4 or less than the sum of  the active_page longdesc + 4</p>
