jquery 怎么写?
jquery 在页面中三种写法
jQuery 分 2 个系列版本 1.x 与 2.x,主要的区别在于 2.x 不再兼容 IE6、7、8浏览器,这样做的目的是为了兼容移动端开发。由于减少了一些代码,使得该版本比 jQuery 1.x 更小、更快。
如果开发者比较在意老版本 IE 用户,只能使用 jQuery 1.9 及之前的版本了。
jQuery是一个JavaScript脚本库,不需要特别的安装,只需要我们在页面 <head> 标签内中,通过 script 标签引入 jQuery 库即可。
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script> <script> // 第一种写法 $(function(){ $("div").html(""); // add your code here }) // 第二种写法 $(document).ready(function(){ $("div").html(""); $("a").click(function(){ // add your code here }) }) // 第三种写法 window.onload = function(){ // add your code here } </script>
更多jquery的相关知识,可访问:web前端自学!!