jQuery链式编程

jQuery链式编程:

   原因:因为很多jQuery方法直接返回 当前的jQuery对象,所以可以接着 . 出方法;

   1. 不返回jQuery对象的方法:val(),html(),text(),attr(), 返回文本字符串;

   2.返回新的jQuery对象的方法:next() nextAll() parent() children() prev() ...

   3.剩下基本都是返回当前jQuery对象;

 

原文地址:https://www.cnblogs.com/chengshun/p/8491356.html