var test = new Array();
test["102-1"] = new Array("102-1", "Elemento");
$(document).ready(function () {
$("a[name='" + test["102-1"][0] + "']").attr({
"data-original-title":test["102-1"][1]
});
});
This code checks the page element (in case it checks the 'name' attribute inside tag a) and if it equals the 'first' Array, it appends the 'date-original-title' attribute with the information of the Array 'first' in position [1].
How can I improve this code to be smarter? Because in this Array you will have more than 209 items. For example:
test["102-1"] = new Array("102-1", "Elemento");
test["102-2"] = new Array("102-2", "Elemento");
test["102-3"] = new Array("102-3", "Elemento");
test["103-1"] = new Array("103-1", "Elemento");
... etc
And for this I will have to create many
$("a[name='" + test["102-1"][0] + "']").attr({
"data-original-title":test["102-1"][1]
});
Is there a way to reduce, causing the code in JS to check and repeat the steps to replace the right items with the right Array?
Hugs to all!