Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

html, css sound problem

when i tried to defind the sound to specific button to activite by clicking on it under this command:

audio id="startCar" src="sounds/startCar.wav" preload="auto"></audio> its dosent work!

but if ill change the command to that one: <audio id="peelOut" src="sounds/peelOut.wav" autoplay></audio> it will auto paly the sound

so that means that the workspaces recognize the audio file but when i want to activate by clicking its dont work, what im doing wrong?!

Bogdan Cabaj
Bogdan Cabaj
16,349 Points

Please share your workspace link...

1 Answer

Steven Parker
Steven Parker
243,656 Points

I see you tested your sound with autoplay, but you also changed the sound.

Did you try adding autoplay to the original sound to be sure it played?

Also, what are you clicking to activate the sound? You probably have another element that is visible and associated with a handler to start the sound. I'd check there for a potential problem.

If you're still having trouble, please make a snapshot of your workspace and post the link to it here.