[Solved] remove text from multiple spans having same id [duplicate]


Dont give same ID to more than one one tag, use class instead

  <span class ="myId">data1</span>
  <span class ="myId">data2</span>
  <span class ="myId">data3</span>
  <span class ="myId">data4</span>
  <span class ="myId">data5</span>

call this function to clear

function clearAll()
{
    var ele= document.getElementsByClassName("myId");
    for(var i=0;i<ele.length;i++)
    {
      ele[i].innerHTML='';
    }
}

2

solved remove text from multiple spans having same id [duplicate]