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

前端 未结 4 1342
长发绾君心
长发绾君心 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:32

    You can't chain a function that returns something other than a jQuery object. For example, attr() with one parameter to get the value of an attribute.

提交回复
热议问题