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
  • 60,010
  • 15
  • 145
  • 220
qadenza
  • 9,025
  • 18
  • 73
  • 126

0 Answers0