前端之家收集整理的这篇文章主要介绍了
AJAX 学习笔记--$的用法,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
javascript 是面向对象的语言,这里的对象就是不同的function var jQuery = window.jQuery = window.$ = function(selector,context) { // ... // other internal initialization code goes here }; You need to know that jQuery,window.jQuery,window.$ or simply $ can be used interchangeably,because as the declaration stated in the code block above tells us,it refers to the same object in memory. $仅仅是一个标识符而已,在许多javascript框架中并用来指向某些主要的类,在我们自己的
代码中并不推荐使用。 [example]var $ = jQeury;[/example]
$,是指prototype定义的一类方法
$("id") 得到的是页面id为"id"的元素
$F("id") 得到的是页面id为"id"的元素的值,这是只读的,不可写
$() 方法是在DOM中使用过于频繁的 document.getElementById() 方法的一个便利的简写,就像这个DOM方法一样,这个方法返回参数传入的id的那个元素。
比起DOM中的方法,这个更胜一筹。你可以传入多个id作为参数然后 $() 返回一个带有所有要求的元素的一个 Array 对象
$F()方法是另一个非常受欢迎的简写。它可以返回任何输入表单控件的值,如文本框或下拉框。 这个方法可以传入元素的id或者元素自己。
资料来源:学网(www.xue5.com),原文地址:http://www.xue5.com/itedu/200802/102501.html