摘要:<!DOCTYPE html> <html> <head> <title>jQuery的基础语法</title> <link rel="stylesheet" type="text/css" href=""> <sc
<!DOCTYPE html> <html> <head> <title>jQuery的基础语法</title> <link rel="stylesheet" type="text/css" href=""> <script type="text/javascript" src="../jQuery/jquery-3.3.1.min.js"></script> </head> <body> <script type="text/javascript"> // 放入javaScript代码或者jQuery代码 // 文档就绪函数 // 基本格式 // $(document).ready(function(){ // jQuery代码 // }) // $(选择器).action() $(document).ready(function(){ // $str='我是一个声明变量' // alert($str); $('div').hide() $('button').click(function(){ $('div').show() }) }) </script> <div style="width:100px;height:100px;background:pink;"></div> <button>点击</button> </body> </html>
批改老师:天蓬老师批改时间:2019-04-10 16:20:05
老师总结:$('button').click(function(){
$('div').show()
})
关于事件, 以后推荐使用on()