摘要: 1、关于页面元素的引用通过jquery的$()引用元素包括通过id、class、元素名以及元素的层级关系及dom或者xpath条件等方法,且返回的对象为jquery对象(集合对象),不能直接调用dom定义的方法。2、jQuery对象与dom对象的转换只有jquery对象才能使用jquery定义的方法。注意dom对象和jquery对象是有区别的,调用方法时要注意操作的是dom对象还是jquery对象。普通的dom对象一般可以通过$()转换成jquery对象。如:$(document.getElementById("msg"))则为jquery对象,可以使用jquery的方法。 阅读全文
posted @ 2011-09-17 22:03 fyen 阅读(309) 评论(1) 推荐(0) 编辑
摘要: Jquery core解析jquery的一般使用方式jquery最常见的用法形如:$(str).func1();str可以是html或者一个选择器,$是个函数,可以把str转换成一个jquery对象。一个jquery对象可以认为是一组dom对象的包装,jquery对象支持多种函数调用“$”到底是个什么东西?在jquery的源代码中,$函数就是jQuery函数,outro.js有如下申明:window.jQuery = window.$ = jQuery;其中jQuery的申明就在core函数里var jQuery = (function(){ var jQuery = function( se 阅读全文
posted @ 2011-09-17 22:02 fyen 阅读(1292) 评论(0) 推荐(0) 编辑
摘要: I was curious how jQuery created it’s chaining API, wrapping up the matched DOM nodes in the return object. It’s a nice pattern that would be useful to use in other scripts.When called, the jQuery object returns an object built using the constructor invocation pattern. The jQuery methods that operat 阅读全文
posted @ 2011-09-17 22:00 fyen 阅读(823) 评论(0) 推荐(0) 编辑