Hi i'm using jQuery in my asp.net mvc application, in this i have created some checkboxes like
$("#dvModules").append('<span><input type="checkbox" id=Module_' + jsModulesData[ctr].Code + ' name="' + jsModulesData[ctr].Name + '" value="' + jsModulesData[ctr].Code + '"> ' + jsModulesData[ctr].Name + '</span><br/>');
i checked some of them and stored its values in database, when i enter it to this page again, i got the values from the database, but i could not check the corresponding checkboxes with their values my code is below:
var arrModuleIDs = SelectedModuleIDs.split(',');
$(document).ready(function () {
SelectedModuleIDs = '@ViewBag.SelectedModuleIDs';
var arrModuleIDs = SelectedModuleIDs.split(',');
for (var i = 0; i < arrModuleIDs.length; i++) {
$("#Module_" + arrModuleIDs[i] + "").attr('checked', true);
//Here the arrmoduleIDs is the values from database.
}
here the loop is performing well but the checkbox is not checked,
can anyone help me to resolve this.
A.Karthi