<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../jquery-3.3.1.min.js"></script>
//这里特别提示一下,这里引入jQuery的时候千万不是写成<script src="../jquery-3.3.1.min.js"/>,这样写的话,网页里面会没有内容,变成空白。
</head>
<body>
<input id="in" type="text"/>
<button id="btn1" type="button" >原生版</button>
<button id="btn2" type="button" >jQuery</button>
<!--javascript-->
<script type="text/javascript">
//绑定文档完成时的监听事件
var btn1 = document.getElementById('btn1');
var inin = document.getElementById('in');
btn1.onclick = function(){
alert(inin.value);
};
</script>
<!--jQuery-->
<script>
//绑定文档完成时的监听事件
$(function(){
//通过id选择器来获取元素
$('#btn2').click(function(){
alert("fdas");
})
})
</script>
jQuery核心函数:$ 也可以写成 jQuery
jQuery核心对象:执行$() 或jQuery()返回的对象
</body>
</html>
对比了一下javascript和jQuery语言,jQuery( Write Less Do more)