1

what is the logic behind a checkbox value?
It is allways on regardless checked or not
I'm expecting a boolean like on-off, 0-1, true-false...
How can I get this?

$('button').on('click', function(){
    let x = $('#inptest').val();
    console.log(x);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>CLICK</button>
<input type='checkbox' id='inptest'>
user2864740
  • 57,407
  • 13
  • 129
  • 202
qadenza
  • 8,611
  • 18
  • 61
  • 108

0 Answers0