Possible Duplicate:
Using jQuery to control HTML5 <audio> volume
I have a html audio tag:
<audio class="audio" autoplay="autoplay" controls="controls" src="All_Right.mp3"></audio>
If it try to set the volume with Javascript like so:
$('.audio').volume = 0.1;
alert($('.audio').volume);
but that doesn’t work.
I assume you’re using jQuery.
$('.audio')returns a jQuery object, not a DOM element.Setting a property on a jQuery object has no effect on the DOM.
Instead, you need to call the jQuery
.prop(name, value)method.