jQuery之DOM对象和jQuery对象的转换与区别分析
本文实例分析了DOM对象和jQuery对象的转换与区别。分享给大家供大家参考。具体分析如下:
jQueryHelloWorld程序:
<scripttype="text/javascript"src="xxx//jquery-x.y.z.js">
引入jQuery.存在两个版本,jquery-x.y.z.min.js是精简压缩版,不带min的是开发版,代码中的注释和缩进等都被保留了.
注意路径中的"/"需要转义,即用"//".
$()符号将DOM对象转化为jQuery对象.
HelloWorld程序如下:
<html>
<head>
<title>HellojQuery</title>
<scripttype="text/javascript"src="libs//jquery-1.11.2.js"></script>
<scripttype="text/javascript">
$(document).ready(function(){
alert("HelloWorld");
});
</script>
</head>
<body>
</body> </html>