HTML 코드
부트스트랩 공식 사이트에 있는 예제 코드를 그대로 사용하였습니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <div class = "txc-textbox" > <!-- Single button --> <div id= "example" class = "btn-group" > <button type= "button" class = "btn btn-default dropdown-toggle" data-toggle= "dropdown" aria-haspopup= "true" aria-expanded= "false" > Action <span class = "caret" ></span> </button> <ul class = "dropdown-menu" > <li><a href= "javascript:void(0)" >Action</a></li> <li><a href= "javascript:void(0)" >Another action</a></li> <li><a href= "javascript:void(0)" >Something else here</a></li> <li role= "separator" class = "divider" ></li> <li><a href= "javascript:void(0)" >Separated link</a></li> </ul> </div> </div> |
Javascript 코드
1 2 3 4 | $( '#example .dropdown-menu li > a' ).bind( 'click' , function (e) { var html = $( this ).html(); $( '#example button.dropdown-toggle' ).html(html + ' <span class="caret"></span>' ); }); |
'Javascript > Bootstrap' 카테고리의 다른 글
[Bootswatch] Bootstrap 테마(Theme)를 좀 더 멋있게 바꿔보자. (0) | 2017.02.26 |
---|