<tfoot id='DaULA'></tfoot>
        • <bdo id='DaULA'></bdo><ul id='DaULA'></ul>
      1. <small id='DaULA'></small><noframes id='DaULA'>

        <i id='DaULA'><tr id='DaULA'><dt id='DaULA'><q id='DaULA'><span id='DaULA'><b id='DaULA'><form id='DaULA'><ins id='DaULA'></ins><ul id='DaULA'></ul><sub id='DaULA'></sub></form><legend id='DaULA'></legend><bdo id='DaULA'><pre id='DaULA'><center id='DaULA'></center></pre></bdo></b><th id='DaULA'></th></span></q></dt></tr></i><div id='DaULA'><tfoot id='DaULA'></tfoot><dl id='DaULA'><fieldset id='DaULA'></fieldset></dl></div>
      2. <legend id='DaULA'><style id='DaULA'><dir id='DaULA'><q id='DaULA'></q></dir></style></legend>

        如何将参数从链接元素传递到模式窗口?

        How to pass a parameter from a link element to a modal window?(如何将参数从链接元素传递到模式窗口?)
                  <tbody id='aPsry'></tbody>

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

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

                • 本文介绍了如何将参数从链接元素传递到模式窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一张桌子.在表格的一个单元格中有一个这样的链接:<a data-toggle="modal" data-id="xyz" href="#remoteModal" data-target="#remoteModal">SOME_TEXT</a>.

                  I have a table. In a cell of the table there is a link like this: <a data-toggle="modal" data-id="xyz" href="#remoteModal" data-target="#remoteModal">SOME_TEXT</a>.

                  当我单击此链接时,应该会打开一个模式.这是一个例子:

                  When I click on this link should open a modal. Here's an example:

                  <div class="modal fade" id="remoteModal" tabindex="-1" role="dialog" aria-labelledby="remoteModal" aria-hidden="true">
                    Some HTML/PHP Code
                  </div>
                  

                  模态必须执行一些依赖于data-id"属性值的操作.准确地说,在 javascript 代码中我需要读取这个值:

                  The modal must perform some operations that depend on the value of "data-id" attribute. To be precise, in the javascript code I need to read this value:

                  <script type="text/javascript">
                  $(document).ready(function ( ) {
                      $('#remoteModal').on('show.bs.modal', function( event ) {
                          console.log( /* How do I read the value of data-id? */ );
                      });
                  });
                  

                  我不知道如何在modal的javascript代码中读取这个属性的值.

                  I do not know how to read the value of this attribute in the javascript code of the modal.

                  非常感谢您的关注.

                  推荐答案

                  使用Modal 事件文档中提到的 .relatedTarget 属性:

                  Use the .relatedTarget property mentioned in the Modal Event docs:

                  $(document).ready(function () {
                      $('#remoteModal').on('show.bs.modal', function (event) {
                          console.log($(event.relatedTarget).attr('data-id'));
                      });
                  });
                  

                  这篇关于如何将参数从链接元素传递到模式窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Draw border around nontransparent part of image on canvas(在画布上的图像不透明部分周围绘制边框)
                  dragging and resizing an image on html5 canvas(在 html5 画布上拖动图像并调整其大小)
                  What#39;s the difference between a boolean as primitive and a boolean as property of an object?(作为原始对象的布尔值和作为对象属性的布尔值有什么区别?)
                  I want to do animation of an object along a particular path(我想沿特定路径对对象进行动画处理)
                  How to upload image into HTML5 canvas(如何将图像上传到 HTML5 画布中)
                  How to show a running progress bar while page is loading(如何在页面加载时显示正在运行的进度条)
                  • <bdo id='7wLny'></bdo><ul id='7wLny'></ul>

                      <tbody id='7wLny'></tbody>
                      • <legend id='7wLny'><style id='7wLny'><dir id='7wLny'><q id='7wLny'></q></dir></style></legend>

                        <small id='7wLny'></small><noframes id='7wLny'>

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