Wedged Posted February 29 Posted February 29 Hi I'm trying to dynamically change the source of a video with a button click. I have several videos to display and would love to be able the user to change them when needed. I have tried it with a normal button and a code element. I have added code: <script> function changeVideoSource() { // JavaScript code to change the video source // For example: var video = document.getElementById('block-yui_3_17_2_1_1709155643233_4986'); video.src = 'https://youtu.be/7m94ip38UKs?si=YEmrvTrkIkR6Zqgw'; console.log('Video source changed Successfully:', video.src); alert('Video source changed successfully!'); } </script> <button onclick="changeVideoSource()">Change Video Source</button> "Video source changed. Successfully: https://youtu.be/7m94ip38UKs?si=YEmrvTrkIkR6Zqgw" But the source doesnt change. Can you see any thing I'm doing wrong?
tuanphan Posted March 2 Posted March 2 You mean hover on each image >> Change video on left? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment