Jquery selected tab
<p>I wanna get selected id from my tabs. I tried anything but but I am very weak in javascript. This my tabs. </p>

<pre><code>&lt;li&gt;&lt;a href="#tab" class="days" id="day_1"&gt;Pondelok&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tab" class="days" id="day_2"&gt;Utorok&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tab" class="days" id="day_3"&gt;Streda&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tab" class="days" id="day_4"&gt;Štvrtok&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tab" class="days" id="day_5"&gt;Piatok&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tab" class="days" id="day_6"&gt;Sobota&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tab" class="days" id="day_7"&gt;Nedeľa&lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>This is my attempt, which return undefined.</p>

<pre><code>&lt;script&gt;
     var selected_tab = $(".ui-state-active").attr("id"); 
     document.write(selected_tab);
&lt;/script&gt;
</code></pre>
