Selecting a single class from a multi class element
<p>I'm trying to select a specific class (in this case page1, page2, page3 etc.) </p>

<p>I've written this code that works fine for a single class, i've tried using <code>.match()</code> to exclude the <code>.plink</code> class picked up in <code>dis</code> but can't get it working.</p>

<pre><code>$(function(){
    $("a.plink").click(function() {
        var dis = $(this).attr("class");    // This is the problem line, I need it to contain 'page1' ONLY. Not 'page1 plink'.
        $("#page1,#page2,#page3").hide();
        $("#" + dis).show();
        return false;
    });
});
</code></pre>

<p>The HTML that is associated with this is:</p>

<pre><code>&lt;div id="page-links"&gt;
    &lt;a class="page1 plink" href="#"&gt;About&lt;/a&gt;
    &lt;a class="page2 plink" href="#"&gt;History&lt;/a&gt;
    &lt;a class="page3 plink" href="#"&gt;Backstage&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>EDIT: </p>

<p>These are the DIV's being shown and hidden:</p>

<pre><code>&lt;div id="page1"&gt;
    &lt;?php include_once("page1.php");?&gt;
&lt;/div&gt;
&lt;div id="page2"&gt;
    &lt;?php include_once("page2.php");?&gt;
&lt;/div&gt;
&lt;div id="page3"&gt;
    &lt;?php include_once("page3.php");?&gt;
&lt;/div&gt;
</code></pre>

<p>Is there a simple way to achieve this without regular expression matching?</p>
