Adopting variable values from HTML data-atributes

前端 未结 2 421
忘掉有多难
忘掉有多难 2021-01-17 06:21

*EDIT

I have a list in my HTML called \"#wordlist\". In this list I hold the words in my game, the attached audio and the attached image to each word. This all works

2条回答
  •  无人共我
    2021-01-17 06:47

    Untested example, get each instance of *data-*number-input and push it into an array:

        var numberInputs = [];  
        var list = document.getElementByID('wordlist');
        var listItems = list.getElementsByTagName('li');
        for(var i = 0;i

提交回复
热议问题