Given the large JSON table in localStorage and the given key, how do I access the associated value and use it as a condition for CSS?
Given the following JSON:
var data = [ { 'myKey': 'A', 'status': 0 }, { 'myKey': 'B', 'status': 1 }, { 'myKey': 'C', 'status': 1 }, { 'myKey': 'D', 'status': 1 } ];
the following html style for styling:
<p id="A">AA</p> <p id="B">BB</p> <p id="C">CC</p> <p id="D">DD</p>
and the following css :
.status1 { color: green; } .status0 { color: red; }
This is one of the basic principles behind "click on your favorite / favorite list / favorite star."
json javascript jquery local-storage
Hugpz
source share