@model HelloWorldMvcApp.SampleViewModel
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
.slider [type="checkbox"] {
transition: background 0.2s ease;
.slider .toggle-label::before {
box-shadow: 0 0 0 1px #d1d1d1;
transition: transform 0.2s ease-in-out;
.slider [type="checkbox"]:checked ~ .toggle-label {
.slider [type="checkbox"]:checked ~ .toggle-label::before {
-webkit-transform: translateX(100%);
transform: translateX(100%);
<section title="HtmlHelper checkbox">
@Html.CheckBoxFor(m => m.IsChecked, new { @class = "toggle-pill" })
@Html.LabelFor(m => m.IsChecked, new { @class = "toggle-label" })
<section title="Generated checkbox">
<input class="toggle-pill" data-val="true" data-val-required="The field is required." id="IsChecked2" name="IsChecked2" type="checkbox" value="true">
<label class="toggle-label" for="IsChecked2"> </label>
<section title="Classic checkbox">
<input type="checkbox" id="IsChecked3" name="IsChecked3" class="toggle-pill" >
<label for="IsChecked3" class="toggle-label"></label>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/mvc/4.0/jquery.validate.unobtrusive.min.js"></script>
<script type="text/javascript">
$('#IsChecked').click(function () {
//$('#sliderSubmit').submit();
if ($(this).is(':checked')) {
$('#IsChecked2').click(function () {
if ($(this).is(':checked')) {
$('#IsChecked3').click(function () {
if ($(this).is(':checked')) {