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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:26:33+00:00 2026-05-27T09:26:33+00:00

I am using datatables inside of the jquery ui tabs. Everything works as expected,

  • 0

I am using datatables inside of the jquery ui tabs. Everything works as expected, except one problem. I would like to trigger a click or select different tab depending on hash value of the url.

This is what I came up with

$(document).ready(function() {
    var hash = window.location.hash;
    if (hash == '') hash = 'add';
    hash = hash.replace('#', '');
    $("a[href=#"+hash+"]").click();
});

This should do the trick normally but it didn’t. an is undefined problem is hunting me for the last 7 hours.

I also tried different approach to solve the issue. For example instead of trying to use .trigger('click') or .click(), I decided to try with jQuery UI Tabs option, select;

$(document).ready(function() {
    var hash = window.location.hash;
    if (hash == '') hash = 'add';
    hash = hash.replace('#', '');

    i = 0;
    $('ul#tablinks li a').each(function() {
        href = $(this).attr('href');
        if (href === '#'+hash)  $( ".tabs" ).tabs("option", "selected", 2); 

        i = i + 1;
    });
});

No matter what I do it I touch anything on tabs menu, I get an is undefined for ( var i=0, iLen=an.length ; i<iLen ; i++ ) ... error.

Did anyone experienced similar problems with the datatables + jquery ui tabs or perhaps you have some advices…

Thank you for your time and concern 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-27T09:26:34+00:00Added an answer on May 27, 2026 at 9:26 am

    For some reason I find solution or way around after posting my problem on SOF. This question is just like others once again and my ‘oh, c’omon now’ reaction seems to be in a loop lately.

    I’m using datatables with server-side processing. Which means data is loaded after the page itself is loaded. That’s why for some reason $(document).ready(); wasn’t providing expected result and I had to add extra time before it will do what I want so;

    setTimeout(function () {
        var hash = window.location.hash;
        if (hash == '') hash = 'add';
        hash = hash.replace('#', '');
        $("a[href=#"+hash+"]").click();
    }, 1000);
    

    Did the trick.
    @David Thomas and @Scruffy The Janitor thank you for your time and concern.

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

Sidebar

Related Questions

I am using the jQuery DataTables plugin. I would like to move the search
I have started using the DataTables plugin (v1.6.2) for jQuery (v1.4.2), and I would
I'm using dataTables with Jquery Mobile. My dataTable is initiated on pageBeforeShow. Inside my
Using .Net and Oracle 11g - I've been returning dataTables from a procedure inside
I am using datatables in my application. Whenever user click on any row I
When I am using DataTables to replace a dataset in a table, it works
I'm using datatables plugin for jquery to show my data on the page. I
I am using jquery data tables server side method example here http://www.datatables.net/examples/server_side/server_side.html My JSON
I heard that microsoft does not recommend using DataSets and DataTables in new projects.
i want to show my input data from DB...i'm interest for using jquery dataTable...

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.