Select all checkboxes does not work
Select all checkboxes does not work
Hi,
I read a lot of discussion about that.. this is my code:
[code] $('#form').submit( function() {
var sData = $('input', oTable.fnGetNodes()).serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return false;
} );
$('#check_all').click( function() {
$('input', oTable.fnGetNodes()).attr('checked', this.checked);
return false;
} );[/code]
If I check the #check_all checkbox nothing appear changes, but when I click the Submit button I get the following message:
00=on&01=on&02=on&03=on&04=on&06=on&05=on&07=on&08=on&09=on&10=on&11=on&12=on&13=on
so this mean that all checkboxes are checked, but they are displayed as not checked. I read also that is better the function prop, but when I replace attr with prop I get the following error on the firebug console:
TypeError: $(...).prop is not a function
$('input', oTable.fnGetNodes()).prop('checked', this.checked);
I know that the prop function is available only with jquery 1.6 +, so I replaced [code][/code] with [code][/code] but I still have the same error. I don't know how to update all the other js file because I bought a template with datatables built in, and I can't find a newer version of it.
How can I solve this problem?
Thanks in advance,
afilini
I read a lot of discussion about that.. this is my code:
[code] $('#form').submit( function() {
var sData = $('input', oTable.fnGetNodes()).serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return false;
} );
$('#check_all').click( function() {
$('input', oTable.fnGetNodes()).attr('checked', this.checked);
return false;
} );[/code]
If I check the #check_all checkbox nothing appear changes, but when I click the Submit button I get the following message:
00=on&01=on&02=on&03=on&04=on&06=on&05=on&07=on&08=on&09=on&10=on&11=on&12=on&13=on
so this mean that all checkboxes are checked, but they are displayed as not checked. I read also that is better the function prop, but when I replace attr with prop I get the following error on the firebug console:
TypeError: $(...).prop is not a function
$('input', oTable.fnGetNodes()).prop('checked', this.checked);
I know that the prop function is available only with jquery 1.6 +, so I replaced [code][/code] with [code][/code] but I still have the same error. I don't know how to update all the other js file because I bought a template with datatables built in, and I can't find a newer version of it.
How can I solve this problem?
Thanks in advance,
afilini
This discussion has been closed.