Is it possible to put green background on the spans that have an id represented in the div?
//Edit. If it makes it easier, just using the keys in the div attribute would work too. data-ids='["1", "2"]' or even data-ids="1,2". Not sure what's possible. If not, is there any clever JS/jQuery implementation that could help out?
<div data-ids='{"1":"Name A", "2":"Name B"}'>
<span data-id="1">This should have green background</span>
<span data-id="2">This should have green background</span>
<span data-id="3">This should have no background</span>
</div>
Dummy code:
div[data-ids=*] span[data-id=*] {
background: green;
}