last day (14 days later) » 

2:03 AM
2
Q: document.querySelector with dynamically created content

sentyI have a div that is dynamically created that is using jQuery and I am trying to use Wavesurfer.js which requires the element to be selected using document.querySelector. Since the elements are dynamically created using jQuery, the selector does not recognise the elements. $( document ).ready(f...

 
@WhiteHat yes. This is all happening in document ready
 
you'll need to ensure that you are calling wavesurfer.init() after you add the element to the page.
 
editing preview code in a sec
 
What is this $('#btn"). ?, check the console, does that not throw an error in your code?
 
Sorry, I updated the code again. It was a typo
 
2:04 AM
The element you are adding only has an id of id="6" not the id="wave6" that you are querying for, change that to $("#audio").append('<div class="row" id="wave6" class="wave"></div>'); or change the query
Hi
 
@DelightedD0D Fixed it, still the same error (Uncaught).
Hi
 
is this page live somewhere?
where we can see it
 
no, I am working in my local machine
should I create a JSFiddle?
 
yes please
 
2:23 AM
I created it but I am not sure why it's not working. I am not getting any errors
I think waveform doesn't get created in jsfiddle. Please try the code in your machine
 

last day (14 days later) »