Bootstrap 3 and Bootstrap switch Example

HTML

<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.0.1/css/bootstrap3/bootstrap-switch.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.0.1/js/bootstrap-switch.js"></script>
  <input type="input" id="inp1" value="">
  <input type="input" id="inp2" value="">
  <input type="checkbox" checked="true" class="alert-status" id="switch" data-size="normal" name="my-checkbox" data-on-text="Android" data-off-text="IOS">
  <input type="checkbox" checked="true" class="alert-status" id="switch2" data-size="normal" name="my-checkbox" data-on-text="Java" data-off-text="C#">

JavaScript

$('.alert-status').bootstrapSwitch('state', true);


    $('#switch').on('switchChange.bootstrapSwitch', function (event, state) {

        var x=$(this).data('on-text');
        var y=$(this).data('off-text');
        if(x=="Android"){
            $("#inp1").val("Android");
        }
         if(y=="IOS"){
            $("#inp1").val("IOS");
        }
    });
    $('#switch2').on('switchChange.bootstrapSwitch', function (event, state) {

        var x=$(this).data('on-text');
        var y=$(this).data('off-text');
        if(x=="Java"){
            $("#inp2").val("Java");
        }
        if(y=="IOS"){
            $("#inp2").val("IOS");
        }
    });