Checkboxes won't get checked in the browser
Hi all,
I have a really weird problem. I update checkboxes (set them to true/false) through jQuery, and their "checked" attribute gets set (when I loop through it), but the checkbox state won't show in the browser. Has someone an idea what it could be??
Here is my code:
- $(document).ready(function () {
-
- $('.search').find(":checkbox").each(function () {
- var $this = $(this);
- $this.change(function () {
- var ac = getCheckBoxClass(this);
- setCheckBoxesAC(ac, this);
- });
- });
- });
- function setCheckBoxesAC(assetClass, checkBox) {
- var curChecked = $(checkBox).is(':checked');
- switch (assetClass) {
- case 'All':
- if (curChecked) {
- $('.search').find(":checkbox").each(function () {
- if (getCheckBoxClass(this) != assetClass) {
- alert($(this).attr('checked'));
- $(this).attr("checked", "checked");
- }
- });
- }
- }
- }
- function getCheckBoxClass(checkBox) {
- return $(checkBox).parent().parent().attr('title');
- }
- function getCheckBoxByClass(ac) {
- var spanSelector = ':span[title=' + ac + ']';
- return $('.search').find(spanSelector).find(':checkbox').attr('id');
- }