RT,例如 $('xxx').find('xxx').find('xxx').find('xxx')...最好能贴个精简版的DOME研究几番
How does jq make it possible to call a method multiple times? -PHP Chinese website Q&A-How can jq call a method multiple times? -PHP Chinese website Q&A
Let’s take a look and learn.
方法执行完再返回jQuery就行了,这个叫jQuery的链式操作。优点有一下:代码更精简。链式操作能大大精简代码量,多项操作一行代码一气呵成,搞定;优化性能。使用链式操作,所有操作代码共享一个jQuery对象,省去了逐步查询DOM元素的性能损耗。
How does jq make it possible to call a method multiple times? -PHP Chinese website Q&A-How can jq call a method multiple times? -PHP Chinese website Q&A
Let’s take a look and learn.
方法执行完再返回jQuery就行了,这个叫jQuery的链式操作。
优点有一下:
代码更精简。链式操作能大大精简代码量,多项操作一行代码一气呵成,搞定;
优化性能。使用链式操作,所有操作代码共享一个jQuery对象,省去了逐步查询DOM元素的性能损耗。