【问题标题】:How to place a checkbox next to a link_to tag in ERB file and when we check a box we should get the values of link_to tag of ERB?如何在 ERB 文件中的 link_to 标签旁边放置一个复选框,当我们选中一个框时,我们应该获取 ERB 的 link_to 标签的值?
【发布时间】:2018-11-30 12:59:21
【问题描述】:

如果我选中复选框并单击 ClickMe 按钮,前端看起来像这样,它应该只提供仅选中的 href

<td class='actions actions-1 my-files' data-hook="admin_orders_index_row_actions">
          <% doc = Spree::BookkeepingDocument.where(printable: shipment.order).last %>
          <% if doc %>
            <%= link_to_with_icon "file", "", admin_bookkeeping_document_path(doc, format: :pdf), title: "Download Invoice" %>
          <input type="checkbox" name="files" class="check"/>`

【问题讨论】:

    标签: jquery erb


    【解决方案1】:
    <span>
        <input type="checkbox" value="<%= admin_bookkeeping_document_path(doc, format: :pdf)%>" name="my-files" style="margin-left: 30%;">
    </span> 
    

    link_to标签之后添加这个sn-p,并在复选框属性值中给出link_to标签值的值。

    【讨论】:

      猜你喜欢
      • 2021-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多