I am having a problem with my code:
b1 = document.getElementById('headerVv');
var playlistId = 'id';
document.addEventListener("DOMContentLoaded", doSomething)
b1.addEventListener('click', function() {
playlistId = 'id2';
doSomething(playlistId)
});
Function doSomething is generating the data on my page. The general thought was to fire up the page with the default playlistId, but when I trigger the eventListener to replace the current data with new playlistId. Swapping the playlistId works, but it's adding new data to the existing data instead of replacing it. Anyone could help me fix it?
doSomething?doSomethingis doing, we can't help heredoSomethinggenerates videos from youtube API based on theplaylistId, When I open the page I want the function to run with the defaultplaylistIdwitch isid, but when I triggereventListenerI want to run the function with newplaylistId, but the data from the initial run ofdoSomothingstays.doSomething