Modify the appearance of the button

Currently, I have a setup where I have three buttons and three panels. When I click on Button 1, Panel 1 loads while Panel 2 and Panel 3 become invisible. Similarly, when I click on Button 2, Panel 2 loads while Panel 1 and Panel 3 are hidden. I would like to change the style of my buttons to resemble a tab container with tabs. Essentially, I want these three buttons to look like tabs. Is it possible to achieve this using CSS in combination with ASP.NET?

Answer №1

If you're looking to implement a system of Togglable tabs

<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="assets/js/bootstrap-transition.js"></script>
<script src="assets/js/bootstrap-tab.js"></script>
<script>
$('#panel a').click(function(e) {
  e.preventDefault();
  $(this).tab('show');
})

// first active
$('#panel a:first').tab('show');
</script>

<div class="tabbable">
<ul id="panel" class="nav nav-tabs">
  <li><a href="#button1" data-toggle="tab>Button 1</a></li>
  <li><a href="#button2" data-toggle="tab>Button 2</a></li>
  <li><a href="#button3" data-toggle="tab>Button 3</a></li>
</ul>
<div class="tab-content">
  <div class="tab-pane fade in active" id="button1">
     Clicking button 1 will display panel 1 </div>
  <div class="tab-pane fade in " id="button2">Clicking button 2 will display panel 2</div>
  <div class="tab-pane fade in " id="button3">Clicking button 3 will display panel 3 </div> 
</div>

Check out the demo : jsfiddle

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

Conceal User Interface Angular Tabulation

I'm working on setting up UI Bootstrap tabs, and for reference you can find the plunker here. My goal is to hide the tabs since I will be utilizing a button to switch between them. Despite adding the following CSS class to my file, the styling is not ...

Issues arise with the functionality of custom jQuery sliders

I'm attempting to create a bootstrap panel slider using my own jQuery code, but it's not functioning as anticipated. My Objective: I have two links for "previous" and "next", and three panels with distinct headings. When the "previous" link is ...

CSS3 alternative to width:calc(100% - 10px)

Currently, I am in need of an alternative solution for migrating my CSS file since some CSS3 features are not being rendered properly on QtWebKit yet. The CSS code that I am working with is as follows: .fit { width: -moz-calc(100% - 10px); width: ...

Display a color box popup when a radio button is selected

I need help implementing a functionality where a popup modal opens when a specific radio button is checked. I have tried using colorbox with an anchor, but it doesn't seem to work with radio buttons. Does anyone have any sample code or suggestions? T ...

Ways to refresh the count of newly added div elements

Currently, I am working on a socket chat program that requires a badge to display the number of users in the chat room every time a new user joins. The code snippet provided below shows a function that adds the name of the new user to the list. The added n ...

Submit a set of form variables to PHP using AJAX

I am attempting to transmit a set of form parameters to a PHP script for processing. In the past, I have achieved this using $.post, but now my goal is to accomplish it exclusively with $.ajax. Below is the jQuery click event designed to send all variabl ...

Error encountered during looping through selected checkbox items with parameters using transactions

While working with transactions in 3 different database tables to insert values, I encountered an issue. After selecting the checkboxes, only one item is being inserted into the database. Error occurred during multiple transaction inserts with parameter ...

jquery is unable to fetch the input value from a dynamically generated field inside a function

Something peculiar keeps happening to me when I utilize jQuery, which is different from what others have encountered in the forums. Whenever I make an ajax call and generate an input element (on success), like so: Start Date: <input type="text" id="gr ...

Troubleshooting JavaScript Date Problem with Internet Explorer 7

When I retrieve a Date from a web method, it comes in the format of "Mon Sep 30 07:26:14 EDT 2013". However, when I try to format this date in my JavaScript code like this: var d= SomeDate.format("MM/dd/yyyy hh:mm:ss tt"); //Somedate is coming from the we ...

Design an ARIA menu role with HTML and CSS code

Currently, my code is set up, but I'm unsure about integrating the tab/arrows to navigate to the sub-menu. You can view the code on jsfiddle: https://jsfiddle.net/Fep5Q/60/ This snippet shows a portion of the HTML code I've implemented: <di ...

I am experiencing difficulty getting Bootstrap Columns to appear next to each other despite trying numerous solutions

Check out this code snippet: <div class="mainptext"> <h3><strong>Master the following:</strong></h3> <div class="container"> <div class="row"> <div class ...

Using JQuery to Send Form Data with an Ajax POST Request

On my web Node/Express app, I have implemented a basic messaging service and am currently attempting to submit the form using Ajax with the FormData object. While the form submission works perfectly without Ajax, all the req.body values are undefined when ...

Get the content of a cell in a table using jQuery

Here is the HTML code I am working with, using Razor to display rows in a table: @foreach (var item in Model.AllGroups) { <tr class="group-row" data-id="@item.Id"> <td class="align-middl ...

yet another problem with overflow-x being hidden while overflow-y is visible

I am currently working on creating a tab overflow user interface that is similar to what Firefox uses. This involves utilizing a combination of fixed width containers and a fluid width container in the middle to hold the tabs. The challenge arises when th ...

Levitating with Cascading Style Sheets

Looking for some assistance to troubleshoot my code. I am trying to make the hover color apply only to the navigation bar and not affect the pictures. I attempted to solve this by specifying .a.main-nav:hover { ...}, but it ended up removing the hover effe ...

Updating the text of an element will occur only when the specified condition has been met

I am trying to dynamically change the text within the <span data-testid="recapItemPrice">ZADARMO</span> element from 'ZADARMO' to 'DOHODOU' only when the text inside the parent element 'INDIVIDUÁLNA CENA PREP ...

Revitalizing HTML and Google Maps with AJAX, PHP, and JQuery

Context: I am currently working on a project that involves integrating a Simple Google Map with an HTML form right below it. The form collects user input and upon submission, sends the data via AJAX to a PHP script for processing API calls and generating i ...

The window.addEventListener function is failing to work properly on mobile devices

Hey there! I am facing an issue in my JS code. I wrote this code because I want the menu to close when a visitor clicks on another div (not the menu) if it is open. The code seems to be working fine in developer tools on Chrome or Firefox, but it's no ...

Issue with KeyboardDatePicker in Material-UI/Pickers occurs when InputAdornmentProps property with position start is added, leading to an unexpected margin

I am currently working with a component from material-ui/pickers and this is the code snippet: <KeyboardDatePicker value={selectedDate} onChange={(_, newValue) => handleClick(newValue)} labelFunc={renderLabel} disableToolbar variant=&a ...

Is it necessary for CSS Media query to load all the referenced CSS files?

When utilizing a CSS Media Query to assign two different stylesheets, such as desktop.css and mobile.css based on the max-width, how does this process function? Is it necessary for both stylesheets to be loaded by the browser every time, and then the appr ...