index.html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>基础核心</title>
<script type="text/javascript" src="jquery-1.10.1.js"></script>
<script type="text/javascript" src="demo.js"></script>
</head>
demo.js
alert($ === jQuery); //相等、恒等
$(function () {
alert($); //jQuery对象的内部
alert($()); //返回的jQuery对象
alert($(‘#box‘)); //返回的也是jQuery对象
alert($(‘#box‘).css(‘color‘, ‘red‘)); //返回的jQuery对象
$(‘#box‘).css(‘color‘, ‘red‘).css(‘font-size‘, ‘200px‘).css(‘font-weight‘, ‘bold‘);
});
$(function () {
alert($(‘#box‘)); //返回jQuery对象
alert(document.getElementById(‘box‘)); //[object HTMLDivElement],原生DOM对象
alert($(‘#box‘).get(0)); //[object HTMLDivElement]
alert($(document.getElementById(‘box‘)).css(‘color‘, ‘red‘)); //jQuery对象和DOM对象之间的互换
});