In Javascript there is a variable where the data is written in JSON format:
var json_test2 = {"a": "2", "b": "2"}; var a = json_test2.a; var b = json_test2.b; I need to proceed from the values of either a , or b , or on the json line as a whole to find the corresponding block in HTML (to display the contents of the block):
<div data-number='{"a": "1", "b": "1"}'>Test1</div> <div data-number='{"a": "2", "b": "2"}'>Test2</div> <div data-number='{"a": "3", "b": "3"}'>Test3</div> How can this be done using javascript (without jQuery)?
data-numberattribute. What is the problem? Where is the code on js that you can't? - ArchDemon Sep.document.querySelector('div[data-number ="{"a": "2", "b": "2"}]'); - Pavel