Form-group in a state of collapse

I am trying to figure out how to create a form-group row with multiple columns and collapse each column separately. The issue I'm facing is that the "div class="collapse" needs to be above the "div class="form group row," making it challenging to tag separate columns for collapsing purposes. EDIT: It seems like one button cannot collapse two distinct elements (1. label 2.input). The code snippet below demonstrates collapsing using two buttons, but is there an easier way to have one button collapse both the label and input simultaneously?

  <div class="form-group row">
<label for="Payment1" class="col-sm-1 col-form-label">Payments:</label>
  <div class="col-sm-3">
    <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample1" role="button" aria-expanded="false" aria-controls="collapseExample1">
      Payment 1
    </a>     

    <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample2" role="button" aria-expanded="false" aria-controls="collapseExample2">
      Payment 2
    </a>

  </div>

Payment 1:

https://jsfiddle.net/Dexter666/4ydq0upk/

Answer №1

Take a look at my suggested solutions for your situation:

https://jsfiddle.net/4ydq0upk/23/

It is recommended to include data-parent in each collapse section and enclose them with the parent data. Please consult the Bootstrap documentation for more information:

https://getbootstrap.com/docs/4.0/components/collapse/

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

An alternative solution for object-fit in wkhtmltopdf

My current challenge involves exporting html pages to pdf using wkhtmltopdf. However, the object-fit I am utilizing to force my images into a square shape is not functioning as expected; instead of being cropped properly, the images are stretched to fit th ...

Utilizing HTML and CSS allows for creating a responsive layout with three elements such as this

Need help with CSS to align three elements in a row, where the first two are on the left and the third is on the right. The layout should adjust so that when the window size is smaller, the second element moves below the first while the third element stays ...

Tips for creating a consistent vertical divider height between columns in bootstrap

I've encountered similar queries before, but the responses provided were not quite what I needed. While one answer came close to my desired outcome, it led to other complications that I am now facing. My main challenge is maintaining consistent vertic ...

Discover the process of transitioning your animations from Angular to CSS

I have successfully implemented a fade-in/out animation using @angular/animation, but now I am looking to transfer this animation to CSS and eliminate the dependency on @angular/animation. Here is my current animation setup (triggering it with [@fadeInOut ...

Share the name of the Quasar component with the Vue 3 render function

I'm struggling to dynamically create a Vue 3 app with different components specified by name, such as "div", "button", or Quasar's "q-btn". When I try to pass the latter to Vue's render function Vue.h, I encounter difficulties. <html> ...

What is the method for adding the square root symbol to a button's value?

I am attempting to display the square root symbol inside a button, but I am having trouble making it work. Below is my button code: <input type="button" id="sqrt" value="sqrt" onclick="insert function here"> For the value, I want the square root sy ...

Updating the background color using typescript

Before transitioning to angular development, I had experience working with vanilla Javascript. I encountered a challenge when trying to modify the css properties of specific elements using Typescript. Unfortunately, the traditional approach used in Javascr ...

Enhance user experience with CSS animations and automatic page reloading on the previous page for both iOS and Android

I need help finding a solution for a transition effect I am implementing in my project. The effect I want to achieve is as follows: Page fades in with an opacity that transitions from 0 to 1 using @keyframes When any link is clicked, the page opacity goe ...

Is it possible to adjust an attribute within a button based on specific conditions by using a flag in the controller with AngularJS?

<button type="button" class="btn btn-outlined" ng-click="vm.change()" data-modal-target="#add-save-all-alert-modal"></button> In my HTML, there is an attribute named "data-modal-target" that triggers a modal when ng-click is activated. I want ...

Two servers, each with its own designated form, and a singular database

Hello, I'm managing two servers. One of them has a form and MySQL database where I input data. The other server only includes a form where I want the data filled in to be sent securely to the first server's database. What is the best method for i ...

How can I make angular material data table cells expand to the full width of content that is set to nowrap?

This example demonstrates how the mat-cells are styled with a specific width: .mat-cell { white-space: nowrap; min-width: 150rem; } If the width is not specified, the table will cut off the text due to the white-space property being set to nowrap. Is ...

Creating a mobile-responsive table using Bootstrap

I am struggling to make my bootstrap table more mobile-friendly. Despite trying various methods, I have not been satisfied with the results. I am interested in how others are successfully adapting their tables to look good on mobile devices while maintaini ...

Move a sub-division horizontally within a parent element that has a full width of 100%

I am currently incorporating some jQuery features into my website. The concept involves expanding the parent div to 100% width for responsive design as you scroll down the page, which works perfectly. Simultaneously, I aim to translateX the child div so th ...

Default behavior in Fullcalendar 6 allows for rendering links on both days of the month and weekdays

Is there a way to customize the rendering of days and weekdays in Fullcalendar React? Currently, they are displayed as links by default (<a>{dayContent}</a>), but I'm looking to have them rendered as <div> or <span>. Any sugges ...

Delay the jQuery event handler for a few milliseconds before triggering

I'm currently working on a navigation menu, but I've encountered some bugs and I'm struggling to fine-tune it completely. Here are the issues I'm facing, and any help or solutions would be greatly appreciated. The menu items (About ...

Is there a way to ensure that an image stays pinned to the bottom of the screen, regardless of the device or screen

Looking for a solution to keep an image centered at the bottom of a website page regardless of screen size? I've tried different recommendations from Stack Overflow without success. position:fixed; bottom:0px; left:50%; Still struggling to make it wo ...

JQuery drag and drop functionality experiencing issues in Chrome Browser specifically when integrated into a Joomla Article

I recently embedded a jQuery drag and drop example into my Joomla article. Surprisingly, it works perfectly fine on Firefox browser but encounters issues on Chrome. Although the drag and drop functionality works on Chrome, the problem is that the buttons b ...

Ensure that PHP does not automatically add a closing tag

After appending the following string to an array in PHP and displaying it, $spineArray[$i]="<itemref idref='part-$i' linear='yes'/>"; The output displays with an unexpected closing tag. What is causing this automatic addition of ...

Is autocomplete="off" disregarded by IE 11?

Currently, I am working on an established ASP.NET/C# application that has been in existence for about three years. Recently, for various reasons, I decided to start using the beta version of Internet Explorer 11. However, upon launching the application in ...

Problems with CSS animations on mobile devices in WordPress

On my website powered by Elementor Pro, I have implemented custom CSS to animate the Shape Divider with a "Brush Wave" style. Below is the code snippet: .elementor-shape-bottom .elementor-shape-top .elementor-shape body { overflow-x:hidden; } @keyframes ...