【问题标题】:Trouble in using Bootstrap and Rails - Radio Button not working properly使用 Bootstrap 和 Rails 时遇到问题 - 单选按钮无法正常工作
【发布时间】:2013-03-19 23:30:41
【问题描述】:

我在 Rails 中使用 bootstrap 时遇到问题。

当我运行以下代码时,我只能选择一个单选按钮。

var ss = "<form accept-charset='UTF-8' action='/add_funds' \
class='simple_form new_fund' id='new_fund' method='post' \
novalidate='novalidate'> \
<input class='radio_buttons optional' id='fund_amount_1' name='fund[amount]' type='radio' value='1' /> \
<input class='radio_buttons optional' id='fund_amount_2' name='fund[amount]' type='radio' value='2' /> \
<input class='radio_buttons optional' id='fund_amount_3' name='fund[amount]' type='radio' value='3' /> \
<input class='radio_buttons optional' id='fund_amount_4' name='fund[amount]' type='radio' value='4' /> \
</form>";
$('.message-dialog-content').html(ss);

欲了解更多信息,请参阅此视频链接。

http://screencast.com/t/3D2Bxj6f37g

有什么帮助吗?

【问题讨论】:

  • 你解决了吗?我正在经历类似的事情。
  • 是的,我做到了。那是因为 jQuery 版本。我使用的是 jQuery 1.9.1,对一些方法(例如 jQuery 中的 attr 与 prop)进行了细微的更改。这是一个链接,您可以参考。 Fixing a problem on using Rails and jQuery1.9.1

标签: ruby-on-rails twitter-bootstrap radio-button toggle


【解决方案1】:

我自己解决了这个问题。那是因为 jQuery 版本。我使用的是 jQuery 1.9.1,对一些方法(例如 jQuery 中的 attr 与 prop)进行了微小的更改。这是一个链接,您可以参考。 Fixing a problem on using Rails and jQuery1.9.1

【讨论】:

    猜你喜欢
    • 2016-10-23
    • 1970-01-01
    • 2013-11-11
    • 1970-01-01
    • 1970-01-01
    • 2018-09-07
    • 2012-10-03
    相关资源
    最近更新 更多