im having a strange problem with a jquery click function. What is suppose to happen is the user clicks a link '.selectlink' and it ticks a box on the page. This works just fine, click it again and it unticks the box.....also fine, click the link once more and nothing at all happens, click it some more and still nothing happens, so the function only seems to work after two clicks then stops working until the page is refreshed.
$(document).on('click', '.selectlink', function () {
var myId = $('#check_' + this.id);
if ($(myId).is(':checked')) {
$(myId).attr('checked', false);
} else {
$(myId).attr('checked', true);
}
countChecked();
});
propand notattr.