【问题标题】:label color change on radio button click单选按钮单击标签颜色更改
【发布时间】:2019-12-03 15:49:06
【问题描述】:

我在带有两个单选按钮的导轨中使用简单的表单。 我希望在选中单选按钮/标签时隐藏单选按钮并更改标签颜色。 但是,目前我可以让它工作的唯一方法是如果单选按钮可见,并且单击它时,标签会改变颜色。 单选按钮的 for 和 id 是相同的,所以这不是问题。 我不确定这个问题。谢谢

<div class="modal-flex">
        <%= f.radio_button "refund_#{invoice.id}", :credit_note, class: "radio-refund" %>
        <%= f.label "refund_#{invoice.id}_credit_note", t(".refund_credit_note"), class: "modal-options refund"%>
        <%= f.radio_button "refund_#{invoice.id}", :only, class: "radio-refund" %>
        <%= f.label "refund_#{invoice.id}_only", t(".refund_only"), class: "modal-options refund" %>
      </div>

  input[type="radio"] + label:before {
    display: none;
  }

 input[type="radio"]:checked + label:after {
    background-color: $color-gray
  }

【问题讨论】:

  • 理想情况下,我们需要输出 HTML 和相关 CSS

标签: css ruby simple-form


【解决方案1】:

用更多的 scss 修复。语法错误

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-26
    • 2012-12-06
    • 1970-01-01
    • 1970-01-01
    • 2021-07-07
    • 2018-02-08
    • 2016-03-30
    • 1970-01-01
    相关资源
    最近更新 更多