Function jquery相当于预加载=";“自动”;在html中?

Function jquery相当于预加载=";“自动”;在html中?,function,onload,pageload,jquery,Function,Onload,Pageload,Jquery,我有html脚本,在加载页面ABC时播放声音: <audio id="s"><source src=".../s.wav" preload="auto"/></audio> <script type="text/javascript">var sample = document.getElementById("s"); sample.play(); s.volume='1';</script> var sample=document

我有html脚本,在加载页面ABC时播放声音:

<audio id="s"><source src=".../s.wav" preload="auto"/></audio>
<script type="text/javascript">var sample = document.getElementById("s"); sample.play(); s.volume='1';</script>

var sample=document.getElementById(“s”);sample.play();s、 体积='1';

如何在jquery中实现
preload=“auto”
功能?

xxx.attr('preload','auto')?
谢谢。对于可能需要此功能的其他人,下面是class=“aaa”的完整解决方案:$('.aaa').attr('preload','auto',sample.play())回调函数语法是什么?我认为它不受支持。我刚刚在我的页面上进行了测试,它可以工作。但我很好奇,正确的方法是什么?
('.aaa').attr('preload','auto').promise().done(函数(){sample.play()})或只是在新行中写入该行。