在facebox和jquery中选择复选框?

发布于 2024-10-09 07:07:51 字数 693 浏览 0 评论 0原文

HTML:

{% for item in result %}
       <tr id="row">
         <td><input name="item" type="checkbox" value="{{ item.number }}"></td>
         <td contenteditable id="col1">{{ item.foo }}</td>
         <td contenteditable id="col4">{{ item.bar }}</td>
       </tr>
{% endfor %} 

我正在使用 facebox 。我想在 facebox 中显示我曾经检查过的单行(检查了 checkbox,位于 first 中) 。 Jquery 是:

 $(document).ready(function() {
    $('#edit').click(function() {
        jQuery.facebox({ div: '#row' })
        return false;
    });
});

这个 jquery 只给我第一行。

HTML:

{% for item in result %}
       <tr id="row">
         <td><input name="item" type="checkbox" value="{{ item.number }}"></td>
         <td contenteditable id="col1">{{ item.foo }}</td>
         <td contenteditable id="col4">{{ item.bar }}</td>
       </tr>
{% endfor %} 

I am using facebox . Where I want to show the single row in the facebox which ever i checked ( checked the checkbox, which is in first <td> ). Jquery is:

 $(document).ready(function() {
    $('#edit').click(function() {
        jQuery.facebox({ div: '#row' })
        return false;
    });
});

This jquery is giving me the first row only.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏末染殇 2024-10-16 07:07:51

您不能对页面中的多个元素使用相同的“id”值。

您可以将其从“id”更改为“class”,它(可能)有效。很难说清楚你到底在做什么。

  <tr class='row'>
    <!-- ... -->
  </tr>

那么

    // ...
    jQuery.facebox({div: '.row'});

当然你可以直接找到 元素:

    jQuery.facebox({div: 'tr'});

You cannot use the same "id" value for more than one element in a page.

You can change that from "id" to "class" and it (might) work. It's hard to tell what exactly you're doing.

  <tr class='row'>
    <!-- ... -->
  </tr>

then

    // ...
    jQuery.facebox({div: '.row'});

Of course you could just find the <tr> elements directly:

    jQuery.facebox({div: 'tr'});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文