Initialize WaveSurfer targeting the container div
问题 I am trying to create waveform using wavesurfer.js for dynamically created elements using JavaScript. Here is my code: $(document).ready(function() { var id = 9; $("#audio").append('<div class="row" id="wave' + id + '"></div>'); $('#audio').on('DOMNodeInserted', 'div', function() { var selectedId = $(this).prop('id'); console.log(selectedId); window['waveForm' + selectedId] = Object.create(WaveSurfer); window['waveForm' + selectedId].init({ container: $(this), waveColor: 'violet',