<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
</head>
<body>
<input type="text" id="text1" value="text" />
<script type="text/javascript">
//dom对象获取
var text = document.getElementById("text1");
//alert(text1.value); //jQuery获取
var $text1 = $(text1);
//alert($text1.val());
var $text2 = jQuery(text1);
//alert($text2.val());
var $text3 = $("#text1");
//alert($text3.val()); //jQuery转dom对象的两种方法
var text2 = $text1[0];
//alert(text2.value);
var text3 = $text1.get(0);
//alert(text3.value); //dom对象转jQuery
var $text4 = $(text);
//alert($text4.val());
</script>
</body>
</html>

源码链接http://code.jquery.com/jquery-1.8.3.min.js

http://code.jquery.com/jquery-1.8.3.js


05-11 13:30