"Fancy Radio Button"
Bootstrap 3.3.0 Snippet by alvaro.prog

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="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.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 ---------->
<script src="https://use.fontawesome.com/b4564248e6.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Fancy Radio Button</title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="./resources/plugins/bootstrap-3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="./resources/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="./resources/css/default.css">
</head>
<body>
<div class="container">
<div class="row">
<!-- RADIO BUTTONS BLOCK -->
<div class="col-xs-12 col-sm-6 col-md-5">
<h3 class="text-center">Radio Button</h3>
<div class="frb-group">
<div class="frb frb-default">
<input type="radio" id="radio-button-0" name="radio-button" value="0">
<label for="radio-button-0">
<span class="frb-title">Lorem Ipsum</span>
<span class="frb-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In semper quam nunc.</span>
</label>
</div>
<div class="frb frb-primary">
<input type="radio" id="radio-button-1" name="radio-button" value="1">
<label for="radio-button-1">
<span class="frb-title">Lorem Ipsum</span>
<span class="frb-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In semper quam nunc.</span>
</label>
</div>
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
.frb-group {
margin: 15px 0;
}
.frb ~ .frb {
margin-top: 15px;
}
.frb input[type="radio"]:empty,
.frb input[type="checkbox"]:empty {
display: none;
}
.frb input[type="radio"] ~ label:before,
.frb input[type="checkbox"] ~ label:before {
font-family: FontAwesome;
content: '\f096';
position: absolute;
top: 50%;
margin-top: -11px;
left: 15px;
font-size: 22px;
}
.frb input[type="radio"]:checked ~ label:before,
.frb input[type="checkbox"]:checked ~ label:before {
content: '\f046';
}
.frb input[type="radio"] ~ label,
.frb input[type="checkbox"] ~ label {
position: relative;
cursor: pointer;
width: 100%;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f2f2f2;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments:

Sir,

In the page load itself if the checkbox checked property is set , then how do we reset it ?

For example , on the html load I have the below code

<input type="checkbox" id="0" name="checkbox" checked value="0"> , after that I am not able to reset the checked

Thanks in advance

mrprasanth () - 5 years ago - Reply 0


Good morning,

I've just tested the code from your example and this plugin handles it properly... If you have any doubts or need some help in a specific issue, send me an e-mail (alvaro.prog@gmail.com)...

Best regards,

Alvaro.

alvaro.prog () - 5 years ago - Reply 0


Thank you, it was my mistake , the id of the checkbox should be "checkbox-0" , then it will work as gem.

mrprasanth () - 5 years ago - Reply 0