Programming Tips - jQuery: get the value of a checkbox

Date: 2016feb3 Library: jQuery Language: javaScript Q. jQuery: get the value of a checkbox A. Assuming you have:
<form> <input name=mycheck> My Check </form>
Get the value as a boolean:
var mycheck = $('input[name=mycheck]').prop('checked');
That gets you boolean, if you prefer "yes" or "no"
var mycheck = toYesNo($('input[name=mycheck]').prop('checked');
Using this function:
function toYesNo(b) { return b ? 'yes' : 'no'; }
Do NOT use val():
var mycheck = $('input[name=mycheck]').val(); // WRONG // Gives you value= from the html no matter if checked or not