首先,您需要从http://jquery.com/下载JQuery库,然后以以下方式在html
head标记中加载jquery库
那么您可以通过在jquery加载脚本之后编码您的jquery代码来测试jquery是否正常工作
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><!--link JQUERY--><script type="text/javascript" src="jquery-3.3.1.js"></script><!--PERSonAL script Javascript--><script type="text/javascript"> $(function(){ alert("My First Jquery Test"); });</script></head><body><!-- Your web--></body></html>如果要单独使用jquery脚本文件,则必须在jquery库加载后以这种方式定义外部.js文件。
<script type="text/javascript" src="jquery-3.3.1.js"></script><script src="js/YourExternalJQueryscripts.js"></script>
实时测试
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><!--link JQUERY--><script type="text/javascript" src="jquery-3.3.1.js"></script><!--PERSonAL script Javascript--><script type="text/javascript"> $(function(){ alert("My First Jquery Test"); });</script></head><body><!-- Your web--></body></html>


