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'>
Aucun commentaire:
Enregistrer un commentaire