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

  • Home
  • SEARCH
  • 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 9193323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:08:04+00:00 2026-06-17T21:08:04+00:00

I have an application that’s running Knockout with a few jQuery plugins, the one

  • 0

I have an application that’s running Knockout with a few jQuery plugins, the one in question here being jQuery UI Tabs.

Through some searching, I’ve found that the data held by jQuery’s data plugin ($(someElt).data()) exists until I apply the bindings through Knockout.

After that, the data held by jQuery is gone, which makes the plugin think it’s not initialized.

What makes this stranger is that my outer set of tabs (there are tabs for the page and tabs in one of the panes of the page’s tabs) works fine.
The inner tabs, however, have this issue.

There are no bindings directly on either of the containers for the tabs, though there are some on elements inside and outside of both (though neither should cause any actual removal of DOM elements).

Any thoughts?

Edit: Here is a test case I created (I’m using jQuery 1.9.2 and Knockout 2.2.1):

<div id="OutterTabContainer">
  <ul>
    <li>
      <a href="#OutterTab1">Outter Tab 1</a>
    </li>
    <li>
      <a href="#OutterTab2">Outter Tab 2</a>
    </li>
  </ul>
  <div id="OutterTab1">
    This is the first tab.
    <div data-bind="visible: test2">This should be invisible</div>

  </div>
  <div id="OutterTab2">
    This is the second tab.
    <div data-bind="text: test1()"></div>

    <div data-bind="with: testObj()">
      <div id="InnerTabContainer">
        <ul>
          <li>
            <a href="#InnerTab1">Inner Tab 1</a>
          </li>
          <li>
            <a href="#InnerTab2">Inner Tab 2</a>
          </li>
        </ul>
        <div id="InnerTab1">
          This is the first of the inner tabs.
        </div>
        <div id="InnerTab2">
          This is the second of the inner tabs.
          @*<div data-bind="text: innerTest()"></div>*@
        </div>
      </div>
    </div>

  </div>
</div>

<script type="text/javascript">
  (function($, ko, undefined) {
    var outterTabs = $("#OutterTabContainer"),
        innerTabs = $("#InnerTabContainer"),
        viewModel = {
          test1: ko.observable("test 1"),
          test2: ko.observable(false),
          testObj: ko.observable({
            innerTest: ko.observable("inner")
          })
        };

    //creating tabs, works fine
    outterTabs.tabs();
    innerTabs.tabs();

    setTimeout(function() {
      //simulating an ajax success callback
      ko.applyBindings(viewModel);
      innerTabs.tabs("select", 1);
    }, 1000);

  })(jQuery, ko);
</script>

In creating this, I found that the culprit is the “with” binding in tab 2. I’m still not sure why that binding would cause this issue, so I’m still looking for an adequate workaround for this. I guess if push comes to shove, I could defer the inner tab initialization until after the view model is bound.

Edit 2: I’ve been looking through the knockout source code, and it’s looking like the with binding runs the same code as the if and ifnot bindings. It looks like the element bound to the with is turned into a virtual element, and from what I can tell, those virtual elements are destroyed and recreated when bindings are applied, so the element itself (and all child elements, including the tab container) would be a different one from the element that was there before. I’m guessing that’s why the data isn’t there anymore (since it’s saved by dom node).

  • 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-06-17T21:08:05+00:00Added an answer on June 17, 2026 at 9:08 pm

    As per my suggestion, you could try something like this (now tested!):

    ko.bindingHandlers["tab"] = {
       init: function(element) {
           $(element).tabs();
       }
    };
    

    And then:

    <div id="InnerTabContainer" data-bind="tab: $data">
    

    Edit: as it turns out, a binding needs some data, even if you aren’t using it.

    Here’s a fiddle

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

Sidebar

Related Questions

I have application that brings response via Ajax and creates 5-20 new jQuery click
I have a application that has jquery draggable div in it. I have placed
I have an application that runs in any one OS (either win7(x86) or win
I have console application that hangs during execution. Here is my configuration: cfg.setProperty(hibernate.connection.driver_class, com.mysql.jdbc.Driver);
I have application that is already running on iOS 5 as well as iOS
I have an application that sends email by relaying it through sendmail. Can I
I have application that makes different queries with different results so the caching in
I have application that is connecting to the DB and if I enter incorrect
I have application that is up more than 3 days. I can see in
I am building a Rails application that contains Developer s who have Application s.

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.