As im dispalying the check boxes with buttons in UI for user to check the books that they currently using, as fivebooks array contains book name and the publication details of the book, as the user checked the allbooks[][] array will hold those checked book data
for example: allbooks[0][1,2]
it contains book 1 and 2 if the user of firstlibrary(0th index) clicked check boxes of 1, and 2
as i need to fetch the allbooks[][] array and view the values
so how to fetch the array and view the values of the array
in allbooks array first index will be the library index
it means there will be morethan one library and each library has five books
i need to fetch the array and view the books that are currently checked
fivebooks array
var fivebooks = {
"how_it_flys":1, "players_in_ground":2, "lets_Start_gaming":3, "gaming_stars":4,
"invisible_man":5
}
After generate your DOM you can for exemple
const checkboxs = document.querySelectorAll('input[type="checkbox"]');
for (var i = 0; i < checkboxs.length; i++) {
console.log(checkboxs[i].checked);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.