Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to check uncheck a checkbox using jquery in metronic admin theme

I am using metronic admin theme for one of my project.

http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469

I have to checked or unchecked check boxes on base of data from database but problem is that i am unable to checked or unchecked a check box in metronic theme using jquery. I have tried both ways to accomplish this task using prop and attr but nothing is working for me. If I run the same code on my custom web page it's working perfectly fine.

$("#checkbox").prop("checked",true);
$("#checkbox").attr('checked',false);
$("#checkbox").attr('checked','checked');
like image 678
Asad Avatar asked Dec 07 '22 22:12

Asad


1 Answers

If you are using metronic, try adding this line after the prop:

$.uniform.update();

Metronic theme uses uniform library to modify standard form element into fancy element. If you check or uncheck element using jquery, it is updated but it is not reflected on front-end. To update this action on front-end you need to update using uniform library.

$.uniform.update() restyles the element depending on updated action.

like image 135
vartika Avatar answered Dec 10 '22 11:12

vartika