localStorage.selectableList = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]"
var list = JSON.parse(localStorage.selectableList);
// Your array of ids var arr = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] // Loop through the array $.each(arr, function (i, val) { // Add class to the respective ids from array items $('#' + val).addClass('active'); });
for(var i=0; i<list.length;>{ console.log(i +"\n---"); }
var index = list.indexOf("2");
var list = JSON.parse(localStorage.selectableList); for (var i = 0; i < list.length; i++) { $('#' + list[i]).addClass('yourcssclass'); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)