How can I remove a footer element using Javascript -


i have html:

<footer class="footer">     <div class="container-fluid wrapper">     ...     </div> </footer> 

how remove whole footer markup using javascript (no jquery available)?

i've tried:

var elem = document.getelementsbyname("footer"); elem.remove(); 

...and couple of other variations, can't delete.

any ideas?

thanks, mark

yes, can this

function removetagbytagname(tagname) {   var ele = document.getelementsbytagname(tagname);   return ele[0].parentnode.removechild(ele[0]); } 

function removetag(tag) {    var ele = document.getelementsbytagname(tag);    return ele[0].parentnode.removechild(ele[0]);  }    var btn = document.getelementbyid("delet");  btn.addeventlistener("click", function(){    removetagbytagname("footer");  });
<body>  <button id="delet">delete footer!</button>      <footer class="footer" name="footer">      <div class="container-fluid wrapper">        blab bal babla      </div>    </footer>  </body>


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -