Home >Web Front-end >JS Tutorial >Chained calls in javascript_javascript skills
The way in jQuery looks like $("#txtName").addClass("err").css("font-size","12px").select().focus(); makes people fascinated by it. The implementation mechanism is chain call. Chain calling is to call the method of an object and then return to the object. Strictly speaking, it does not belong to grammar, but is just a grammar technique. This is the fascinating point of js.
Methods without return values are assignor methods. Obviously, it is easy to implement chain calls, provided that the usage of this pointer is correctly understood.