Skip to content

JavaScript Make Element or div empty and insert new data !

Notifications You must be signed in to change notification settings

nielsoffice/JSMakeElementEmpty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

JSMakeElementEmpty

JavaScript Make Element or div empty and insert new data !

<div id="container">
  This is the current slider data !
</div>

<input type="button" value="Next" id="next" />
 // Make element or div empty then insert new data!
 let slides = ['Second Slide data'];

 let id = document.getElementById('container');
 let next = document.getElementById('next');
    
 next.addEventListener('click', function() {

   id.innerHTML = ""; // id.empty(); in jQuery
   id.innerHTML = slides;
 
 }); 

About

JavaScript Make Element or div empty and insert new data !

Topics

Resources

Stars

Watchers

Forks