Possible Duplicate:
How to listen to when a checkbox is checked in Jquery
I’m creating a number of checkboxes dynamically using JQuery as shown below.
function createCheckbox(len){
for(var i = 0; i < len; i++){
$('#checkboxes').append('<input type="checkbox" ' + 'id=' + i + '></input>');
}
return;
}
In the HTML, I have:
<div id="checkboxes"></div>
My goals is whenever a checkbox is checked, to be able to send it’s id (or value) to this function:
function hideColumn(columnIndex){
$('#chart2 td:nth-child(' + (columnIndex+1) + ')').hide();
return;
}
Which will be able to handle the logic of hidding a particular column in my table.
Could somone please help me with that?
Thanks
may be you can try this,just by modify createCheckbox function: