"RadioButtons"
Bootstrap 3.1.0 Snippet by hempmax

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<h2>Simulação de RadioButton com botões</h2>
<div class="form-group">
<label for="campus" class="col-sm-4 col-md-4 control-label text-right">
Em que Campus você está?
</label>
<div class="col-sm-7 col-md-7">
<div class="input-group">
<!--
<div id="radioBtn" class="btn-group">
<button class="btn btn-primary btn-sm noActive" data-toggle="campus" data-title="SBC">
<span class="glyphicon glyphicon-search"></span>
SBC
</button>
<button class="btn btn-primary btn-sm noActive" data-toggle="campus" data-title="SP">
<span class="glyphicon glyphicon-user"></span>
SP
</button>
<button class="btn btn-primary btn-sm noActive" data-toggle="campus" data-title="FEI">
<span class="glyphicon glyphicon-lock"></span>
FEI
</button>
</div>
-->
<div id="radioBtn" class="btn-group">
<a class="btn btn-primary btn-sm noActive" data-toggle="campus" data-title="SBC">SBC</a>
<a class="btn btn-primary btn-sm noActive" data-toggle="campus" data-title="SP">SP</a>
<a class="btn btn-primary btn-sm noActive" data-toggle="campus" data-title="FEI">FEI</a>
</div>
<!-- Deixar este campo com type=hidden -->
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
html{
background:#505D6E url(http://www.gettemplate.com/demo/magister/assets/images/body4.jpg) no-repeat center center fixed;
}
#radioBtn .noActive{
color: #3276b1;
background-color: #fff;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$('#radioBtn a').on('click', function(){
var sel = $(this).data('title');
var tog = $(this).data('toggle');
$('#'+tog).prop('value', sel);
$('[data-toggle="'+tog+'"]').not('[data-title="'+sel+'"]')
.removeClass('active')
.addClass('noActive');
$('[data-toggle="'+tog+'"][data-title="'+sel+'"]')
.removeClass('noActive')
.addClass('active');
});
/*
Version 3.0.0
=========================================================
bootstrap-datetimepicker.js
https://github.com/Eonasdan/bootstrap-datetimepicker
=========================================================
The MIT License (MIT)
Copyright (c) 2014 Jonathan Peterson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: