selector value equals element value
<p>I have this html code:</p>

<pre><code>&lt;input type="hidden" id="selector" value="home" /&gt;
&lt;ul id="hmenu"&gt;
    &lt;li&gt;&lt;a href="index.php" page="home"&gt;Home&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="gallery.php" page="gallery"&gt;Gallery&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="about.php" page="about"&gt;&lt;/a&gt;About&lt;/li&gt;
    &lt;li&gt;&lt;a href="contact.php" page="contact"&gt;Contact&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>and this jquery code:</p>

<pre><code>$(document).ready(function(){
    var $page = $('#selector').val();
    $("#hmenu a[page='" + $page + "']").addClass("active");
});
</code></pre>

<p>it supposed to add a class 'active' to the match value of '' into the match value of attribute 'page' of the anchor tag in ul element which has an id of hmenu but unfortunately, didnt work and no effect.</p>

<p>the result should be this if successfull:</p>

<pre><code>&lt;ul id=hmenu"&gt;
    &lt;li&gt;&lt;a href="index.php" page="home" class="active"&gt;Home&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="gallery.php" page="gallery"&gt;Gallery&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="about.php" page="about"&gt;About&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="contact.php" page="contact"&gt;Contact&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>as you can see this <code>"&lt;li&gt;&lt;a href="index.php" page="home" class="active"&gt;Home&lt;/a&gt;&lt;/li&gt;"</code> has a class of active thats because the attribute 'page' value has match to value of ''</p>

<p>hope someone here could help, thanks in advance. Im open in ideas, suggestions and recommendations.</p>
