function showVal() { var div =
$("#div"); alert("showVal(): "+div.val()); 显示为空 } function showHtml() {
var
div = $("#div"); alert("showHtml(): "+div.html()); 显示为:
here
is a paragram
here
is a big DIV
} function
showText() {var div = $("#div"); alert("showText(): "+div.text()); 显示为: here
is a paragram here
is a big DIV } 总结:val()---一般
用在input上,而不用在其他元素,用来获取input或者是select的值 html()和text()可用在多种元素上,但是html()相当于依据源代码返回,也就是在返回的内容中会包含各种tag,而text()则相当于是依据页面显示返回,返回的内容是出去各种tag之间的内容html属性中有两个方法,一个有参,一个无参