Is it possible to update the content in the tab bar using Bootstrap 4?

My project involves HTML, CSS, and Bootstrap 4. It includes a search box with multiple tabs. The issue I'm facing is that when I switch tabs, the tab content doesn't change and new content gets added to the old one. What might be the problem?

You can view the codes here:

[Text](https://codepen.io/setarezre/pen/qBRVjJe?editors=1000)

.searchBox {
  background: #f6f7fb;
  border-radius: 3px;
  box-shadow: 0 6px 20px rgba(24, 104, 188, .07);
  direction: rtl;
}

.searBox-top {
  position: absolute;
  width: 100%;
  top: 50%;
  right: 50%;
  transform: translate(50%, -50%);
  -webkit-transform: translate(50%, -50%);
  -moz-transform: translate(50%, -50%);
  -ms-transform: translate(50%, -50%);
  -o-transform: translate(50%, -50%);
}

.searchBox .adult-search button {
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

...
                    
</section>

Answer №1

Ensure that the tab container, labeled "tab-content," is singular to allow for proper toggling of content. To display tabs correctly, follow this standard structure:

<ul class="nav nav-tabs">
  <li class="active"><a data-toggle="tab" href="#tab1">Tab1</a></li>
  <li><a data-toggle="tab" href="#tab2">Tab2</a></li>
</ul>
<!-- Use one "tab-content" container for all tabs -->
<div class="tab-content">
  <div id="tab1" class="tab-pane fade in active">
    <h3>Tab1</h3>
    <p>Include desired content here.</p>
  </div>
  <div id="tab2" class="tab-pane fade">
    <h3>Tab 2</h3>
    <p>Add content accordingly.</p>
  </div>
</div>

Link to Example

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Input fields that are dynamically generated do not respond to changes made using .click and .blur methods in jQuery CSS

I'm experiencing an issue with a HTML form where a new input field is generated when a button is clicked, but the dynamically created field is not styled properly. Below is the HTML form code: <form id="form"> <input type="text" id="ent ...

Leveraging Vue.js with Bootstrap4 modal components

I've been attempting to implement a modal that appears with a simple change in my data using a vue @click event on an element, but for some reason, the modal isn't showing up. I could really use some guidance on how to make this work. Just to cl ...

Animation unveiling of text slides

I have been working on designing a unique button for my personal diet app project that involves a sliding text effect when the mouse hovers over it. I'm almost there, but I've encountered a major issue that seems impossible to solve. I want the s ...

Using AJAX to showcase information from a web API in organized table formats

Looking for guidance on integrating a web API from the URL "" using jQuery AJAX to populate a table. I've searched for tutorials without much success. ...

JavaScript - Why does my "or" equation not recognize the second value?

I am currently working on developing a function that enables a PNG image to be moved up, down, left, or right by the user using either the WASD keys or the Arrow Keys. While I have successfully implemented the movement using WASD, I am facing an issue wh ...

How can I anchor a div Banner saying "Get 50% off our products" to the Navbar directly above it?

Bootstrap Question: How can I attach the div Banner ("50% off of our products") to the Navbar directly above it? The structure looks like this: <Navbar> </Navbar> <div> <span>Discount: 50% off of our products </span </di ...

Issue with modal not being able to close the embedded video iframe

I have created a demo of a video in my footer that uses external CSS files and works perfectly. However, when I added it to the project, everything works except for closing the video. After clicking the play button in the footer, a modal appears on the sc ...

Is it possible to reset the value of a current request attribute?

I designed a homepage that consists of a header, a sidebar, and a div tag. When a user clicks on the "register" button, Registration.jsp is loaded into the div tag. After successfully submitting the registration form, I want to redirect it back to the sa ...

Ways to activate javascript following a PHP submission?

It's a bit tricky to explain. function m(val){ var element=document.getElementById('othermethod'); if(val=='others') element.style.display='block'; else element.style.display=&apo ...

Navigate through each element with a specific class name in a block of HTML code using

Currently, I am dealing with an HTML string that is being retrieved through AJAX. Let's assume it looks like this: var htmlString = '<div class="post"></div><div class="post"></div>'; I want to find a way to iterat ...

Does anyone else have trouble with the Smtp settings and connection on Servage.net? It's driving me crazy, I can't figure it out!

Whenever I attempt to connect to send a servage SMTP, it gives me this error message: SMTP connect() failed. I have tried using the following settings: include('res/mailer/class.phpmailer.php'); $mail->SMTPDebug = 2; include('res/mai ...

Converting HTML to PDF in Flutter without using the flutter_html_to_pdf package for Flutter web compatibility

Is there a way to convert HTML content to PDF in Flutter that supports both mobile and web? I have the following HTML content: content: <p>sample text</p><p><b>sample text</b></p><p><i><b>sample text& ...

Restrict the number of simultaneous image downloads in HTML

I am currently seeking the most effective solution for throttling image downloads in a Single Page Application. Issue: When on a slow network and navigating to a details page, there is an overload of image downloads occurring which pushes browser connect ...

Error Message: Google Sheets Script encountered an issue while trying to align the cell content to the center using `

I seem to be encountering an issue with this particular script where it consistently generates the error mentioned in the title. Title: cell.setHorizontalAlignment(SpreadsheetApp.HorizontalAlignment.CENTER) function CustomFont() { // var spreadsheet ...

Is there a way to properly align unordered lists (such as a navigation menu) within a div with a width set at

UPDATE: I found a creative solution to my issue. By adding margin-left and margin-right set to auto, along with fixing the width of the nav menu to 1002px and setting its positioning to relative, I was able to achieve the desired effect. Additionally, I cr ...

What steps can I take to ensure this conversion meets markup validation requirements?

I keep encountering a validation error that keeps coming up: $("#preview").html('<div align="center"><img src="/ajaximage/loader.gif" alt="Uploading...."/></div>'); The error message states: document type does not allow elemen ...

Is it possible to adjust the width of a parent element based on the number of child

In this particular example, I have structured a header with a logo-container positioned on the left side, a menu in the center, and a button on the right. The menu consists of 5 top-level items and 2 sub-menus. <div class="container"> <div cla ...

Using Twig: Transfer the content of a textfield as a parameter in the routing

I have a task of redirecting to another page while passing along the value from a textfield. Here is my current code: {% extends "base.html.twig" %} {% block body %} <button onclick="host()">Host the session</button> <button onclic ...

The Semantic-UI Dropdown does not appear when utilizing the sidebar feature

Is it normal for a dropdown in the pusher not to show when using a sidebar? I tried setting overflow-visible but it didn't work. Any suggestions on how to resolve this? Check out this JSFiddle example: https://jsfiddle.net/3djmjhn5/1/ Code: $(&ap ...

Is it possible to use AJAX to change the class name of a Font Awesome icon?

I am considering updating the icon after deleting a row. Should I initially include the font awesome icon once in the blade, then remove the class name and add it back with ajax? blade: <div id="status-{{ $country->id }}"> <div id ...