7
Reply

get value in hidden checkbox

Mega Anaska

Mega Anaska

Jan 15 2018 11:06 PM
177
hi guys I have coding html like
 
<div class="m-t-10" style="margin-bottom:10px;">
<div class="switch-ss">
<input type="checkbox" data-init-plugin="switchery" />
</div>
<button class="btn btn-white btn-xs btn-mini bold fs-14 btn-default" type="button"><i class="fa fa-trash-o"></i></button>
<div class="clearfix"></div>
</div>
and css like :
.switch-ss{
display: block;
padding: 5px;
background-color: #fff;
border-radius:2px;
width: 30px;
height: 27px;
float: left;
line-height: 14px;
margin-right: 5px;
}
.switchery{
height: 9px !important;
width: 20px !important;
border-radius:10px !important;
border-color:#dedede !important;
}
.switchery>small{
height: 9px !important;
width: 9px !important;
/* margin-top: 1px; */
background-color: #a8aaab !important;
border-radius:100% !important;
}
 
the question is I want get value when I click that switch but when I click the switch the checked always return false, what should i do ?
 
this is my javascript
 
var chk = $('.switch-ss input[type=checkbox]').is(':checked');
console.log(chk)

Answers (7)