JavaScript and querySelector

后端 未结 4 567
情话喂你
情话喂你 2021-01-25 03:55

I have this HTML:

Intermediate steps

\"intermediate
4条回答
  •  清歌不尽
    2021-01-25 04:14

    document.querySelector returns the first element within the document thus the error. you probalbly want to try: document.querySelectorAll

    var elements = document.querySelectorAll(".staticStep img");
    
    elements[0].src  =.....
    elements[1].src  =.....
    elements[2].src  =.....
    

    Or you could use jQuery instead.

提交回复
热议问题