Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery conflict with identical scripts
    primarykey
    data
    text
    <p>I am using jquery to load content into tabs, and switch the tabs on click. My problem is that one one page I am using this "tab switcher" twice, and it is causing a conflict. I am not too experienced with jquery, so my problem probably lies in the fact that I am creating the function twice in the head. Here is my jquery (you will notice that there are duplicate scripts, with the selectors changed up a bit so the "tab switchers" appear different.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { //When page loads... $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); }); &lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { //When page loads... $(".tabs_content").hide(); //Hide all content $("ul.tab li:first").addClass("active").show(); //Activate first tab $(".tabs_content:first").show(); //Show first tab content //On Click Event $("ul.tab li").click(function() { $("ul.tab li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tabs_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); }); &lt;/script&gt; </code></pre> <p>My css is all correct, I know the problem is above.The second script works fine, and the first script doesn't.</p> <p>You can see this live here: <a href="http://vitaminjdesign.com/littlewindow/about/" rel="nofollow noreferrer">link</a> You will notice that the second script works fine (at the bottom : margie and todd. And the first script doesn't work (in the sidebar :categories and archives.)</p> <p>Any idea how to fix this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload