javascript$(document).on('click')在html中不起作用

javascript$(document).on('click')在html中不起作用,html,document,Html,Document,下面是我的.html代码文件,它似乎根本没有加载click函数。我错过了什么吗 我是新手,对此有任何帮助都会很好 <html> <body> <h1> hello </h1> <audio id="audio"> <source src="http://dl.dropbox.com/u/1538714/article_resources/song.ogg" type="audio/aac">

下面是我的.html代码文件,它似乎根本没有加载click函数。我错过了什么吗

我是新手,对此有任何帮助都会很好

<html>
<body>
    <h1> hello </h1>
    <audio id="audio">
    <source src="http://dl.dropbox.com/u/1538714/article_resources/song.ogg"     type="audio/aac">
    </audio>

<script type="text/javascript">
function dosomething(){
    $('body').append('document click<br />');
    document.getElementById('audio').play();};
    $(document).on('click', function(){dosomething()});
</script>
</body>
</html>

您需要首先添加jQuery库

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
你好 功能剂量测定法{ $'body'。附加'documentclick'; document.getElementById'audio'.play;}; $document.on'click',函数{dosomething};
请检查下面的答案,您错过了jQuerylibrary@2060754z如果对您有效,请勾选答案。我将在期限后:-