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 3871534
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:49:59+00:00 2026-05-19T21:49:59+00:00

How to make tabs on the web page so that when click is performed

  • 0

How to make tabs on the web page so that when click is performed on the tab, the tab gets css changed, but on the click page is also reloaded and the css is back to original.

  • 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-19T21:49:59+00:00Added an answer on May 19, 2026 at 9:49 pm

    dont use the jquery 😀

    all of what you needs a container, a contained data in a varable and the tabs

    the container is the victim of the css changes.
    the tabs will trigger the changing process.

    if you have a static content, you can write this into a string, and simply load it from thiss.
    if you have a dinamically generated content, you need to create ajax request to get the fresh content, and then store it in the same string waiting for load.

    with the tabs you sould create a general functionusable for content loading.

    function load(data) {
        document.getElementById("victim").innerHTML = data;
    }
    
    function changeCss(element) {
    //redoing all changes
    document.getElementById("tab1").style.background="#fff";
    document.getElementById("tab2").style.background="#fff";
    
    element.style.background = "#f0f";
    }
    

    with static content the triggers:

    document.getElementById("tab1").onclick = function() {load("static data 1");changeCss(document.getElementById("tab1"))};
    document.getElementById("tab2").onclick = function() {load("static data 2");changeCss(document.getElementById("tab2"))};
    

    if you want to change the css, you need another function which do the changes.

    i tell you dont use the jquery because you will not know what are you doing.

    but thiss whole code can be replaced by jquery like this:

    $("tab1").click(function(e) {
        $("#tab1 | #tab2").each(function() {
        $(this).css("background","#fff"); });
        $(this).css("background","#00f");
        $("#victim").append("static content 1");
    });
    
    
    $("tab12click(function(e) {
        $("#tab1 | #tab2").each(function() {
        $(this).css("background","#fff"); });
        $(this).css("background","#00f");
        $("#victim").append("static content 2");
    });
    

    if you know how javascript works then there is noting wrong with the jquery, but i see there is more and more people who just want to do their website very fast and simple, but not knowing what are they doing and running into the same problem again and again.

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

Sidebar

Related Questions

For the following example: http://developer.yahoo.com/yui/examples/tabview/frommarkup_clean.html I would like to make the tabs right aligned
How do I make vi - Vim never use tabs (converting spaces to tabs,
make is not only useful for building your programming project, but it seems to
I make a lot of web applications and from time to time I need
To make click-able divs, I do: <div class=clickable url=http://google.com> blah blah </div> and then
I have a page with some tabs on it and upon clicking on certain
I want to make this thing more generic. <%= form_for :page, :url => {
I currently have a tab layout with 2 tabs, one tab with a list
Make a new AS3 Document in Flash, paste in the following code and run
To make it short: hibernate doesn't support projections and query by example? I found

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.