switch div tags using javascript doesnt work in xhtml strict <p>Hi i need to switch between div tags, I have no idea where's the problem... The site is XHTML strict...</p> <pre class="lang-js prettyprint-override"><code>$(document).ready(function() { var activeId = $(".active").each(function(){ $("#content" + $(this).attr("id").replace("tab","")).show(); }); $(".tabs a").click(function() { var $tabs =$(this).closest(".tabs"); $("#content" +$tabs.attr("data-lastContent")).hide(); $(this).closest(".tabs").find(".active").removeClass("active"); $(this).addClass("active") var id = $(this).closest("li").attr("id").replace("tab",""); $tabs.attr("data-lastContent", id); $("#content" + id).show(); }); });​ </code></pre> <p>It is a menu and some divs below I need to switch... I use the code from this post <a href="http://jsfiddle.net/hKMFb/24/" rel="nofollow">http://jsfiddle.net/hKMFb/24/</a> but with no success....</p> <pre><code>&lt;div class="tabs" data-lastContent="1"&gt; &lt;li id="tab1" class="active"&gt;&lt;a href="#"&gt;PROSBA&lt;/a&gt;&lt;/li&gt; &lt;li id="tab2"&gt;&lt;a href="#"&gt;PRŮVODNÍ TEXT&lt;/a&gt;&lt;/li&gt; &lt;li id="tab3"&gt;&lt;a href="#"&gt;GALERIE&lt;/a&gt;&lt;/li&gt; &lt;li id="tab4"&gt;&lt;a href="#"&gt;JAK POMOCI?&lt;/a&gt;&lt;/li&gt; &lt;/div&gt; &lt;div id="content1" class="content"&gt;&lt;div class="scroller"&gt;ahojjjj&lt;/div&gt;&lt;/div&gt; &lt;div id="content2" class="content"&gt;&lt;div class="scroller"&gt;nee&lt;/div&gt;&lt;/div&gt; &lt;div id="content3" class="content"&gt;&lt;div class="scroller"&gt;ahdad&lt;/div&gt;&lt;/div&gt; &lt;div id="content4" class="content"&gt;&lt;div class="scroller"&gt;ahod&lt;/div&gt;&lt;/div&gt; </code></pre> <p>Any input is appreciated.</p> <p>Thanks. Jan</p>