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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:40:13+00:00 2026-05-14T14:40:13+00:00

I had tabs with preloaded content like this: $(function () { $(‘div.tabs ul.tabNavigation a’).click(function

  • 0

I had tabs with preloaded content like this:

$(function () {

    $('div.tabs ul.tabNavigation a').click(function () {
        $('div.tabs ul.tabNavigation a').removeClass('selected');
        $(this).addClass('selected');
        return false;
    }).filter(':first').click();
});

This added class=”selected” to links and css made selected tab look different

<div class="tabs"> 
    <ul class="tabNavigation"> 
        <li><a href="#content1">c1</a></li> 
        <li><a href="#content2">c2</a></li> 
        <li><a href="#content3">c3</a></li>
    </ul> 
    <div id="content1"> 
         content 1
    </div> 
    <div id="content2">
         content 2
     </div> 
     <div id="content3"> 
        content 3 
     </div>

Now I`m trying to get ajax to work. Well It’s working but I’m having troube getting Class=”selected” to my links.

The js function with ajax looks like this:

$(function() {
    $("#tabs").tabs({
        ajaxOptions: {
            error: function(xhr, status, index, anchor) {
                $(anchor.hash).html("there was a problem");
            }
        }
    });
});

How can I extend it so that it gives clicked link class “selected”? Similar to the preloaded content version.

  • 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-14T14:40:14+00:00Added an answer on May 14, 2026 at 2:40 pm
    $(function() {  
        $("#tabs").tabs({
            ajaxOptions: {
                error: function(xhr, status, index, anchor) {
                    $(anchor.hash).html("Laadimisel ilmnes viga");
                }
            }
        });
        $('#tabs A').click(function(){
            if($(this).hasClass('selected')){ return false; }
    
            $('#tabs A.selected').removeClass('selected');
            $(this).addClass('selected');       
            return false;
        });
    });
    

    This worked.

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

Sidebar

Related Questions

I had inserted two jQuery tabs on my site. One div container had the
Before i tried loading the content via the .load() jquery function, i had an
Had this working; at one stage. The problem is the following text is now
I had a list <li> where the content inside li should get bold when
I have a UI using dynamic tabs, so content can be loaded into a
I have a fair amount of Facebook development experience, but this had made me
I had 4 UITableView which represents 4 tabs from my UITabBar. So I have
I'm trying to implement this application. At the moment I have designed tabs on
I am developing an small application in a android. Before this i had done
In my framework project I have a class that represents tabs in a content

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.