admin管理员组文章数量:1355574
I'm currently trying to setup some bootstrap radio buttons. The code looks like the one from the Bootstrap examples, but the event is not fired to set a label active. Here's my code:
<div id="mergeType" class="btn-group">
<label for="radio1" class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio1" value="OVW">Überschreiben
</label>
<label for="radio2" class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio2" value="ADD">Hinzufügen
</label>
<label for="radio3" class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio3" value="KEE">Gefunde behalten
</label>
<label for="radio4" class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio4" value="DEL" checked="checked">Gefundene entfernen
</label>
</div>
I don't do anything with the radio buttons in the JavaScript backend. What might be the issue here?
I'm currently trying to setup some bootstrap radio buttons. The code looks like the one from the Bootstrap examples, but the event is not fired to set a label active. Here's my code:
<div id="mergeType" class="btn-group">
<label for="radio1" class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio1" value="OVW">Überschreiben
</label>
<label for="radio2" class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio2" value="ADD">Hinzufügen
</label>
<label for="radio3" class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio3" value="KEE">Gefunde behalten
</label>
<label for="radio4" class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio4" value="DEL" checked="checked">Gefundene entfernen
</label>
</div>
I don't do anything with the radio buttons in the JavaScript backend. What might be the issue here?
Share Improve this question asked Jun 16, 2016 at 9:15 macskaymacskay 4011 gold badge3 silver badges19 bronze badges2 Answers
Reset to default 5You did not add jquery plugin: Here is the working answer
https://jsfiddle/sesn/wLvzd193/2/
There is nothing wrong with your html
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-sm btn-success active">
<input type="radio" name="mergeType" id="radio1" value="OVW">Überschreiben
</label>
<label class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio2" value="ADD" checked>Hinzufügen
</label>
<label class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio3" value="KEE">Gefunde behalten
</label>
<label class="btn btn-sm btn-success">
<input type="radio" name="mergeType" id="radio4" value="DEL">Gefundene entfernen
</label>
</div>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="options" id="option1" autoplete="off" checked> Radio 1 (preselected)
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option2" autoplete="off"> Radio 2
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option3" autoplete="off"> Radio 3
</label>
</div>
There's some weird problem about jsfiddle link to be present in the answer. Stack overflow's new stack snippet is preferred. But, I don't have time right now to figure out how to use stack snippet.
Sorry for the long intro. Just copy and paste your code in jsfiddle and run it. The code works just fine. I mean you wanted the radio buttons to toggle, right? So, there you go!
Please revert if you have any more queries.
本文标签: javascriptBootstrap Radio Buttons not togglingStack Overflow
版权声明:本文标题:javascript - Bootstrap Radio Buttons not toggling - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743969518a2570501.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论