Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3460012
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:10:41+00:00 2026-05-18T10:10:41+00:00

I would like to create a tab view just by hide and show div

  • 0

I would like to create a tab view just by hide and show div element with mootools.I am stucked by using mootools and got confused.

Following list generated dynamically from php and we can’t guess the element id. When we are click on each list item; it should apply the active class for the same and remove active class from current list item.

<div class="lorem_ipsum">
<div class="lorem">
    <ul id="main_tabs">
        <li id="815" class="active" onclick="tabManage()">Lorem Ipsum</li>
            <li id="816" onclick="tabManage()">John</li>
            <li id="817" onclick="tabManage()">Lorem Text</li>
        <li id="818" onclick="tabManage()">Demo Text</li>
    </ul>
</div>

<script language="javascript">
 function tabManage()
 {

$('815').addClass = "active";

$('816').removeClass = "active";

$('817').removeClass = "active";

$('818').removeClass = "active";
}
</script>

How can we apply a loop in the javascript. Please any body can help me to write javascript script function for same.Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:10:41+00:00Added an answer on May 18, 2026 at 10:10 am

    here’s your quick tabs in 10 mins in mootools (best viewed in FF due to quick CSS3 styling): http://www.jsfiddle.net/dimitar/THQWn/

    (function() {
        // closure - to be run in a domready block.
        var tabs = document.id("main_tabs").getElements("li");
        var output = document.id("output"), divs = output.getChildren();
    
        tabs.addEvents({
            click: function(e) {
                // clear up all tabs of 'active'
                tabs.removeClass("active");
                // make this active and remove the mouseover effect
                this.addClass("active").removeClass("over");
    
                // make all content hidden
                divs.addClass("hide");
    
                // remove hidden class from the div that links to our id.
                output.getElement("div[rel=" + this.get("id") + "]").removeClass("hide");
            },
            mouseenter: function() {
                if (!this.hasClass("active"))
                    this.addClass("over"); // not applicable to active
            },
            mouseleave: function() {
                this.removeClass("over");
            }
        });
    
    })();
    

    note that i am doing some slight changes in the markup but it ought to be enough to get you started

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like create my own collection that has all the attributes of python
I would like create a web service in ASP.Net 2.0 that will supports JSON.
Would like to create a strong password in C++. Any suggestions? I assume it
I would like to create a database backed interactive AJAX webapp which has a
I would like to create an SSL connection for generic TCP communication. I think
I would like to create a file format for my app like Quake, OO,
I would like to create a stored procedure in MySQL that took a list
I would like to create an application wide keyboard shortcut for a Java Swing
I would like to create events for certain resources that are used across various
I would like to create an XML-based website. I want to use XML files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.