• <bdo id='n1X34'></bdo><ul id='n1X34'></ul>
    <tfoot id='n1X34'></tfoot>
    <i id='n1X34'><tr id='n1X34'><dt id='n1X34'><q id='n1X34'><span id='n1X34'><b id='n1X34'><form id='n1X34'><ins id='n1X34'></ins><ul id='n1X34'></ul><sub id='n1X34'></sub></form><legend id='n1X34'></legend><bdo id='n1X34'><pre id='n1X34'><center id='n1X34'></center></pre></bdo></b><th id='n1X34'></th></span></q></dt></tr></i><div id='n1X34'><tfoot id='n1X34'></tfoot><dl id='n1X34'><fieldset id='n1X34'></fieldset></dl></div>

        <legend id='n1X34'><style id='n1X34'><dir id='n1X34'><q id='n1X34'></q></dir></style></legend>

        <small id='n1X34'></small><noframes id='n1X34'>

      1. jquery 链接是如何工作的?

        how does jquery chaining work?(jquery 链接是如何工作的?)

        <small id='ioBzB'></small><noframes id='ioBzB'>

              <tbody id='ioBzB'></tbody>

              <i id='ioBzB'><tr id='ioBzB'><dt id='ioBzB'><q id='ioBzB'><span id='ioBzB'><b id='ioBzB'><form id='ioBzB'><ins id='ioBzB'></ins><ul id='ioBzB'></ul><sub id='ioBzB'></sub></form><legend id='ioBzB'></legend><bdo id='ioBzB'><pre id='ioBzB'><center id='ioBzB'></center></pre></bdo></b><th id='ioBzB'></th></span></q></dt></tr></i><div id='ioBzB'><tfoot id='ioBzB'></tfoot><dl id='ioBzB'><fieldset id='ioBzB'></fieldset></dl></div>
              • <bdo id='ioBzB'></bdo><ul id='ioBzB'></ul>
                  <legend id='ioBzB'><style id='ioBzB'><dir id='ioBzB'><q id='ioBzB'></q></dir></style></legend>
                1. <tfoot id='ioBzB'></tfoot>
                2. 本文介绍了jquery 链接是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我不是在问什么是适当的链接语法,我知道它可能是这样的:

                  I am not asking what is the appropriate syntax for chaining, I know it could be something like:

                  $('myDiv').removeClass('off').addClass('on');
                  

                  但是我真的很想了解它的内部工作原理,据我所知,链接是相对于其他著名框架的优势之一,但是对于像我这样的新手程序员来说,这对于我们来说非常抽象,我敢肯定有没有人可以为我提供解释,让我了解链接的工作原理.

                  However I'm really curious to understand the inner working of it, as far as I know chaining is one of the advantages against other famous frameworks but this us to much abstraction for a novice programer like me, I'm sure there is someone out there that can provide me with a explanation that allows me to understand how chaining works.

                  谢谢!

                  推荐答案

                  如果你有一个带有某些方法的对象,如果每个方法返回一个带有方法的对象,你可以简单地从返回的对象中调用一个方法.

                  If you have an object with certain methods, if each method returns an object with methods, you can simply call a method from the object returned.

                  var obj = {   // every method returns obj---------v
                      first: function() { alert('first');   return obj; },
                      second: function() { alert('second'); return obj; },
                      third: function() { alert('third');   return obj; }
                  }
                  
                  obj.first().second().third();
                  

                  演示: http://jsfiddle.net/5kkCh/

                  这篇关于jquery 链接是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What are valid deviceNames for Chrome emulation testing with Protractor?(使用 Protractor 进行 Chrome 模拟测试的有效设备名称是什么?)
                  Protractor Check if Element Does Not Exist(量角器检查元素是否不存在)
                  Protractor e2e Tests Login Redirection(Protractor e2e 测试登录重定向)
                  Explain about async/ await in Protractor(解释 Protractor 中的 async/await)
                  Protractor browser.wait doesn#39;t wait(量角器 browser.wait 不等待)
                  How to use Protractor with Angular 2?(如何在 Angular 2 中使用量角器?)
                    <tbody id='yvXBD'></tbody>

                3. <small id='yvXBD'></small><noframes id='yvXBD'>

                  • <tfoot id='yvXBD'></tfoot>
                    <i id='yvXBD'><tr id='yvXBD'><dt id='yvXBD'><q id='yvXBD'><span id='yvXBD'><b id='yvXBD'><form id='yvXBD'><ins id='yvXBD'></ins><ul id='yvXBD'></ul><sub id='yvXBD'></sub></form><legend id='yvXBD'></legend><bdo id='yvXBD'><pre id='yvXBD'><center id='yvXBD'></center></pre></bdo></b><th id='yvXBD'></th></span></q></dt></tr></i><div id='yvXBD'><tfoot id='yvXBD'></tfoot><dl id='yvXBD'><fieldset id='yvXBD'></fieldset></dl></div>

                          <bdo id='yvXBD'></bdo><ul id='yvXBD'></ul>

                            <legend id='yvXBD'><style id='yvXBD'><dir id='yvXBD'><q id='yvXBD'></q></dir></style></legend>