카테고리 없음

[단추] 버튼 그룹을 라디오 버튼 그룹처럼 작동하게 만드는 방법은 무엇입니까?

행복을전해요 2021. 2. 2. 03:03
<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-primary">
      <input type="radio" name="options" id="option1"> Option 1
        </label>
          <label class="btn btn-primary">
              <input type="radio" name="options" id="option2"> Option 2
                </label>
                  <label class="btn btn-primary">
                      <input type="radio" name="options" id="option3"> Option 3
                        </label>
                        </div>
                        

그리고 js로 초기화 : JavaScript를 통해 버튼 활성화 :

$('.btn').button()

레이블에 "active"클래스를 추가하여 활성화 할 수 있습니다- "btn btn-primary active"및 "checked"입력 라디오에.



출처
https://stackoverflow.com/questions/22049885