select multiple elements by ID in one line

前端 未结 5 2108
自闭症患者
自闭症患者 2021-01-06 08:56

I would like to know if there is a better/cleaner way to accomplish what I have in the code below.

var updateJob = function(){
    document.getElementById(\         


        
5条回答
  •  难免孤独
    2021-01-06 09:29

    Try this:

    var toggle = ["jobDescription","updateButton","equipmentList","jobDesc","equipRan"],
        l = toggle.length, i;
    for( i=0; i

    Alternatively, put all those elements in one container and just toggle that.

提交回复
热议问题