We can do this using JavaScript, no need of jQuery. Just pass the changed element and let JavaScript handle it.
HTML
<form id="myform">
syn<input type="checkbox" name="checkfield" id="g01-01" onchange="doalert(this)"/>
</form>
JS
function doalert(checkboxElem) {
if (checkboxElem.checked) {
alert ("hi");
} else {
alert ("bye");
}
}