Select an element if ID partially matches
<p>I have the following HTML:</p>

<pre><code>&lt;header&gt;
  &lt;nav&gt;
    &lt;ul&gt;
        &lt;li id="menu-item-1"&gt;&lt;a href="javascript:void(0)"&gt;Lien 1&lt;/a&gt;&lt;/li&gt;
        &lt;li id="menu-item-2"&gt;&lt;a href="javascript:void(0)"&gt;Lien 2&lt;/a&gt;&lt;/li&gt;
        &lt;li id="menu-item-3"&gt;&lt;a href="javascript:void(0)"&gt;Lien 3&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/nav&gt;
&lt;/header&gt;

&lt;article id="content"&gt;
  &lt;div id="post-1" class="page"&gt;
    &lt;p&gt;content post 1&lt;/p&gt;
  &lt;/div&gt;
  &lt;div id="post-2" class="page"&gt;
    &lt;p&gt;content post 2&lt;/p&gt;
  &lt;/div&gt;
  &lt;div id="post-3" class="page"&gt;
    &lt;p&gt;content post 3&lt;/p&gt;
  &lt;/div&gt;
&lt;/article&gt;
</code></pre>

<p>The idea is the following: if the number after <strong>menu-item-</strong> matches the number after <strong>post-</strong> then do something.</p>

<p>How do I do that?</p>

<p>The final goal is to display each div when i click on the corresponding menu link</p>

<pre><code>menu-item-1 -&gt; display post-1
menu-item-2 -&gt; display post-2
menu-item-3 -&gt; display post-3
</code></pre>

<p>Thanks !</p>
