User:Toad64/Sandbox: Difference between revisionsGive feedback
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
// In your Common.js | // In your Common.js | ||
$(document).ready(function() { | $(document).ready(function() { | ||
$('audio').each(function() { | $('audio').each(function() { | ||
const $this = $(this); | |||
const | const src = $this.attr('src'); | ||
// | // Log what we found to the console so we can see why it's undefined | ||
console.log("Processing element:", this); | |||
console.log("Source found:", src); | |||
if (src) { | |||
const myPlayer = document.createElement('audio-player'); | |||
myPlayer.setAttribute('track', src); | |||
$this.replaceWith(myPlayer); | |||
} else { | |||
console.warn("Skipping element because src is undefined:", this); | |||
} | |||
}); | }); | ||
}); | }); | ||