lundi 27 août 2018

How to give different input with different onclick, javascript?

var array1 = [
   "a","b","c"
]
document.getElementsByClassName("class").onclick = myFunction;
function myFunction(){
    var array2 = document.getElementsByClassName("class");
    videoContainer.attribute=array1[0];
}

this would work, but is there a way to make it easier and link the class array length with the other array("array 1" and "array 2"), like a for loop or something else




Aucun commentaire:

Enregistrer un commentaire