I have an array of data. I have put this data on my site in different places over different attributes, how innerHTML value placeholder etc. Is it possible to link this values with the array from where I can take data? So that when I change the data in array, it going automatic changed on the site? Also I try to show how I did it mean:
var test = Array();
test['place1'] = 'NY';
var myspan = document.createElement('span');
myspan.innerHTML = test['place1'];
On some event the value of test['place1']
is changed to 'LA'
, and at the same moment the value of myspan.innerHTML
must be changed too.
Native JS only please.