DEVHIDE
        • Home (current)
        • About
        • Contact
        • Cookie
        • Home (current)
        • About
        • Contact
        • Cookie
        • Disclaimer
        • Privacy
        • TOS
        Login Or Sign up

        bootstrap tab('show') not work on dynimcally loaded 'tab-content'

        1.3k Views Asked by Hakan Fıstık At 23 December 2016 at 12:13 2025-12-18T21:45:24.977738

        I am using ASP.NET MVC and boostrap 3

        I am using bootstrap tabs, my main view like this

          <div class="row">
              <div class="tabs-container">
                  <ul class="nav nav-tabs" id="test">
                      <li class="active"><a data-toggle="tab" href="#tab-operations">Operations</a></li>
                      <li class=""><a data-toggle="tab" href="#tab-categories">Categories</a></li>
                  </ul>
                  @Html.Partial("_Ordering", Model)
              </div>
          </div>
        

        the partial view _Ordering like this

        <div class="tab-content" id="ordDiv">
            <div id="tab-operations" class="tab-pane active">
                // some content not important
            </div>
            <div id="tab-categories" class="tab-pane">
                // some content not important
            </div>
        </div>
        

        and I am using unobtrusive-ajax to update the partial view

        @Ajax.ActionLink("cancel", "PartialOrdering", null,
            new AjaxOptions { HttpMethod = "GET", Url = Url.Action("PartialOrdering"), UpdateTargetId = "ordDiv", InsertionMode = InsertionMode.Replace }, null)
        

        the content of the tab updating correctly wihout any problem.

        the problem is i want to show the tab which already was exists before the ajax request refreshed the content. I used js code for this like this

        var a = $('#test li.active').find('a');
        a.click();      // not showing the content of the tab
        a.tab('show');  // also this not showing the content of the tab
        

        the previous code does not make any error in the console, but the desired tab is not shown

        ajax asp.net-mvc twitter-bootstrap tabs partial-views
        Original Q&A
        1

        There are 1 best solutions below

        1
        Aamir Aamir On 23 December 2016 at 13:06

        If you want to show a specific tab here you will need to pass the id of specific anchor tag and based on that anchor you can call the tab() function.

        $(document).ready(function(){
          activeaTab('tab-categories');
        });
        function activeaTab(tab){
          $('.nav-tabs a[href="#' + tab + '"]').tab('show');
        };
        

        https://jsfiddle.net/ewaeLkvv/

        Related Questions in AJAX

        • window.location.href redirects but is causing problems on the webpage
        • Js variable to php using ajax
        • TypeError: Failed to execute 'arrayBuffer' on 'Blob': Illegal invocation - Insert blob into database
        • how do I change a URL with form to include additional selection
        • why i have to put extra space in before write option selected because it show error if i don't ' option:selected'
        • Opening modal through Update button with specified ID using ajax
        • Events disappear randomly for full calendar module
        • Ajax call reloads page in FrontAccounting, a PHP ERP solution
        • Add newly added record to select2 element
        • AJAX query cascading dropdown in django
        • Failed to load resource: the server responded with a status of 403 () - SCRIPT - WordPress
        • Maintaining search and sort state across paginated results in web application
        • Getting POST 500 Internal server error while sending request via ajax call
        • Wordpress server side datatable filtering
        • Having a problem in datatables and fullcalendar scripts

        Related Questions in ASP.NET-MVC

        • I have a problem outputing the roles on the page ListRoles.cshtml
        • Dropdown list showing SQLServer2005SQLBrowserUser$DONSERVER instead of Active Directory group name in ASP.NET MVC C#
        • Hosting ASP.NET MVC application on IIS web server using Windows 2019 server
        • How to display only department fields associated with a selected department in student automation system?
        • How to send select input data for form submission?
        • Multi level project reference using dll
        • How to upload file to Onedrive using ASP.NET MVC?
        • ASP.NET MVC web app looping between fields only on some devices
        • Is there any automatic job to load AD-groups?
        • How to restrict admin js files to download
        • Download PDF in ASP.NET MVC application
        • How to add bootstrap theme/example into ASP.NET MVC 5?
        • Web API works with Windows authentication enabled when consumed via Swagger but throws an unauthorized issue when accessed through web app
        • ASP.Net Core 7.0 Web App (Model-View-Controller) ErrorViewModel OnGet OnPost do not get called or executed
        • OAuth 2.0 keep getting Authorization has been denied for this request

        Related Questions in TWITTER-BOOTSTRAP

        • General questions about creating a custom theme Moodle CMS
        • How to fix - The modal dissapear below 992px.?
        • Bootstrap horizontal gutters issue
        • How can I add a list of icons to the right of a text area
        • Why isn't my Bootstrap background color class working as expected?
        • Edit button in each row of table using same Bootstrap modal as add button
        • Change Opacity of Bootstrap Button
        • bootstrap 5 multiple tab dropdown with tab pane
        • Bootstrap v5.3 navbar drop-downs not working. Why?
        • Should i learn Bootstrap in 2024
        • How to turn on Bootstrap Intellisense in .NET 8 Blazor
        • Bootstrap 5.3 burger menu not responsive in Underscore WordPress template
        • Bootstrap 5 columns not displaying inline
        • Bootstrap scaffolding not showing good on mobile
        • How to Prevent Select2 Dropdown from Moving with Scroll inside a Bootstrap Vue Modal?

        Related Questions in TABS

        • Visual Studio 2022 convert spaces to tabs on checkout and back to spaces on checkin
        • How to get new text input after entering a password in a tab?
        • I need assistance with scripting between tabs for Google Sheets
        • Removing tabPanel(s) with same title in shiny
        • I want change the color of TabRow to black using indicatorColor = Color.Black, but in material3 indicatorColor not exist anymore
        • Change background on Tab react native app
        • User non Administer System on Apache Guacamole can access history tab?
        • Chrome Extension: Uncaught SyntaxError: Unexpected reserved word
        • Switching between tabs Ant Design Vue
        • Automatically log the user out when the browser or tab closes
        • create new workbook from excel tab and save to new location and close it and then grab the next tab and save to a different location using VBA
        • Make the Reviews Tab Active on Elementor Product Data Tabs
        • Blazor Web App: How to correctly open razor pages from referenced projects in new tabs?
        • Visual Studio 2022 Community: Tab Spacing Off (Extra Indent?)
        • How to create a pivot table that pulls data from multiple tabs?

        Related Questions in PARTIAL-VIEWS

        • Accessing value from dynamic object
        • Return partial View if model state was not valid
        • MVC Login form in all page i want using PartialView
        • Binding Model data to form in ASP.NET MVC
        • MVC - Html.DropdownListFor disappearing when selectpicker class is added to HTML attributes
        • Model is null while rendering view
        • How to reference dropdown in MVC Application
        • how to add partial hbs file inside master hbs file in sugarcrm
        • Laravel trying to add custom css file inside a partial view with @include
        • Passing model data to partial view
        • Update partial view on non-MVC Asp.Net Core 6 RazorPages with Ajax
        • C# MVC multiple loading javascript
        • Is there any way we can use .cshtml partial view in a React web application?
        • Partial form saving and loading without full page postback in ASP.NET Core 7 Razor Pages?
        • Create a partial view in MVC c# that use a Javascript object with some parameter

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)

        Popular # Hahtags

        javascript python java c# php android html jquery c++ css ios sql mysql r reactjs node.js arrays c asp.net json

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?
        .

        Copyright © 2021 Jogjafile Inc.

        • Disclaimer
        • Privacy
        • TOS
        • Homegardensmart
        • Math
        • Aftereffectstemplates