jquery - Retrieve Check box from array they stored in -
i have function , want create function retrieve check box array (user_card_declare_data_list) on model again
userobj.savedeclarationform = function () { var user_card_declare_data_list = [] $(".option").map(function () { var user_card_declare_data = {} if ($(this).find(".result_val")[0].checked == true) { user_card_declare_data.result_val = 1; } else { user_card_declare_data.result_val = 0; } user_card_declare_data_list.push(user_card_declare_data); }) $('#mymodal').modal('hide'); userobj.declaration = user_card_declare_data_list; }
change
var user_card_declare_data_list = []
to:
var user_card_declare_data_list = this.user_card_declare_data_list = []
now can access array in other methods of userobj
with:
this.user_card_declare_data_list
Comments
Post a Comment