Bootstrap: set initial radio button checked in HTML

后端 未结 3 477
故里飘歌
故里飘歌 2021-01-01 14:22

I\'m using Bootstrap\'s JavaScript buttons to style some radio buttons, and I don\'t seem to be able to set an initial button as checked.

Here is my code:

3条回答
  •  春和景丽
    2021-01-01 14:58

    If you want the Bootstrap button() component to recognize the checked inputs initially you need to add some jQuery like..

    $('[checked="checked"]').parent().addClass("active");
    

    This will set the active state to the appropriate buttons/labels in the group.

提交回复
热议问题