-1

我目前正在做一个 Rails 项目。我正在创建一个 text_field 和一个 select_tag。我希望连接它们并根据 text_field 更改 select_tag 值。

例如:我的下拉列表有两个选项,数字和字母。如果我输入“12345”,下拉框会自动变为“数字”。如果我输入“你好”,下拉框会自动变为“字母”。

我是网络编程的新手。如果有人也能告诉我如何在 rails 中使用这个 jquery 脚本,那就太棒了!

非常感谢!!!

4

1 回答 1

0

This answer tells you how to find out if the value is numeric or alphanumeric. Once you know that, you can use jQuery to change the value of your select_tag. Hope that helps.

于 2013-07-15T21:54:04.443 回答