what is wrong with my code? it works in browser but does not work on iPhone.
var list = JSON.parse(localStorage.getItem("theListSelectMenu_array"));
Array.prototype.uniqueObjects = function (props) {
function compare(a, b) {
var prop;
if (props) {
for (var j = 0; j < props.length; j++) {
prop = props[j];
if (a[prop] != b[prop]) {
return false;
}
}
} else {
for (prop in a) {
if (a[prop] != b[prop]) {
return false;
}
}
Code: Select all
}
return true;
}
return this.filter(function (item, index, list) {
for (var i = 0; i < index; i++) {
if (compare(item, list[i])) {
return false;
}
}
return true;
});
};
var uniquestoreName = list.uniqueObjects(["storeName"]);
var uniquestoreId = list.uniqueObjects(["storeId"]);
var uniquestoreKnowName = list.uniqueObjects(["storeKnowName"]);
var dropDown = Appery("mobileselectmenu_12");
dropDown.empty();
dropDown.append(
$('' + "Select a Store" + '')
);
$.each(uniquestoreName, function(index, option) {
dropDown.append(
$('' + option.storeName + '')
);
});
dropDown.selectmenu("refresh");