toggle switch with Map List select

by I Sang Hyeon

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<div>
  <span>
    <p>OFF</p>
    <label class="switch">
      <input type="checkbox" id="chk" />
      <span class="slider round"></span>
    </label>
    <p>ON</p>
  </span>
</div>
<p id="ppp"></p>

CSS

/* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 20px;
  vertical-align:middle;
}

/* Hide default HTML checkbox */
.switch input {display:none;}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0%;
  left: 0%;
  right: 0%;
  bottom: 0%;
  background-color: #CCC;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 13px;
  width: 13px;
  left: 4px;
  bottom: 4px;
  background-color: #FFF;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(10px);
  -ms-transform: translateX(10px);
  transform: translateX(10px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

p {
	margin:0%;
	display:inline-block;
	font-size:10px;
	font-weight:bold;
}

JavaScript

let arrHeader = [{col:'C1',knm:'일번',enm:'first'},{col:'C2',knm:'이번',enm:'second'}];

$('#chk').click(function(){
	let headerName = $('#chk').attr('checked') ? 'enm' : 'knm';
	$('#ppp').text(
  	arrHeader[0][headerName] + '::' + arrHeader[1][headerName]
  );
});
/*
$(function () {
  $('#chk').on('click',function(){
    $('#ppp').text(
      $('#chk').attr('checked')
    );
  });

});
*/