Answer the question
In order to leave comments, you need to log in
Iterating over an object and deriving values?
There is an object:
var jsonObj = new Object({
"A0OA1": {
"prod1": "308 - 23 µm",
"prod2": "555 - 12-15 µm",
"prod3": "333 - 15-17 µm"
},
"A0OA2": {
"prod1": "308 - 23 µm",
"prod2": "555 - 12-15 µm",
"prod3": "333 - 15-17 µm"
},
"A0OA3": {
"prod1": "308 - 30 µm",
"prod2": "555 - 15-17 µm",
"prod3": "333 - 17 µm"
},
});
Есть кнопки , условно
<button data-key="A0OA1">button1</button>
<button data-key="A0OA2">button2</button>
<button data-key="A0OA3">button3</button>
$('button').click(function (event) {
var dataK= $(this).attr("data-key");
for (var [key, value] of Object.entries(jjsonObj.dataK)) {
console.log(value);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question