jQuery chaining: Can everything be chained? When can we not chain?

前端 未结 4 1362
长发绾君心
长发绾君心 2020-12-10 03:05

I know that not all jQuery functions can be chained together. Is there a rule of thumb on this. When can we not chain 2 functions together.

4条回答
  •  臣服心动
    2020-12-10 03:55

    The way to distinguish is that functions which have side effects typically return jquery and can be chained where as functions with an actual return (like .text()) cannot.

提交回复
热议问题