I have a list of questions that is getting loaded from a database when the page loads. I am parsing the list of questions, and added a checkbox to each question. I am planning on adding the id of each check box to an array which I am going to then pass back to the database for further processing.
$.each(data.d.crit1,function(key,value){
var rowId = 'QID_0'+value.CLASS_QUESTION_ID;
var codes = value.CODES ? value.CODES : '';
$("#tblCrit1").append("<tr class='row' id='"+rowId+"'></tr>");
$("#"+rowId).addClass('critical1').css('cursor','pointer')
.append("<td class='chckbox'><input type='checkbox' id='cbx_Q"+value.CLASS_QUESTION_ID+"'/></td>")
.append("<td>"+value.QUESTION_TEXT+"</td>")
.append("<td>"+codes+"</td>");
});
I am attempting to attach an on change event handler to the check boxes, but for some reason, I cannot get the event to fire.
I've tried a few different methods that I thought should have worked. Something like:
$("input[type=checkbox]").on('change',function(){...});
and a few other permutations with no luck.
I'm apparently doing something wrong, but I can't seem to figure it out. Any help would be appreciated.