【jquery】怎么用js调用标签的onclick事件
给你一个示例:
<!DOCTYPE html><html><head><meta charset=”utf-8″> <title>菜鸟教程(runoob.com)</title> <script src=”https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js”></script><script>$(document).ready(function(){ $(“button”).click(function(){ $(“p”).hide(); });});</script></head><body><h2>这是一个标题</h2><p>这是一个段落。</p><p>这是另一个段落。
如何在单独的js文件里调用jquery
需要准备的材料分别有:电脑、html编辑器、浏览器。
1、首先,打开html编辑器,新建html文件,例如:index.html,先引入jquery。
2、在index.html中的</body>标签前,引入自己写的js文件,例如index.js文件。
3、在index.js中调用jquery的函数。
4、浏览器运行index.html页面,此时成功调用了index.js中编写的内容。
在jQuery里$(this).hide()表示什么意思,并且这里面的this指什么东西?
$(t
THE END